3 #ifndef PY_SSIZE_T_CLEAN
4 #define PY_SSIZE_T_CLEAN
8 #error Python headers needed to compile C extensions, please install development version of Python.
9 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
10 #error Cython requires Python 2.6+ or Python 3.3+.
12 #define CYTHON_ABI "0_29_24"
13 #define CYTHON_HEX_VERSION 0x001D18F0
14 #define CYTHON_FUTURE_DIVISION 0
17 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
19 #if !defined(WIN32) && !defined(MS_WINDOWS)
31 #define DL_IMPORT(t) t
34 #define DL_EXPORT(t) t
37 #ifndef HAVE_LONG_LONG
38 #if PY_VERSION_HEX >= 0x02070000
39 #define HAVE_LONG_LONG
43 #define PY_LONG_LONG LONG_LONG
46 #define Py_HUGE_VAL HUGE_VAL
49 #define CYTHON_COMPILING_IN_PYPY 1
50 #define CYTHON_COMPILING_IN_PYSTON 0
51 #define CYTHON_COMPILING_IN_CPYTHON 0
52 #undef CYTHON_USE_TYPE_SLOTS
53 #define CYTHON_USE_TYPE_SLOTS 0
54 #undef CYTHON_USE_PYTYPE_LOOKUP
55 #define CYTHON_USE_PYTYPE_LOOKUP 0
56 #if PY_VERSION_HEX < 0x03050000
57 #undef CYTHON_USE_ASYNC_SLOTS
58 #define CYTHON_USE_ASYNC_SLOTS 0
59 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
60 #define CYTHON_USE_ASYNC_SLOTS 1
62 #undef CYTHON_USE_PYLIST_INTERNALS
63 #define CYTHON_USE_PYLIST_INTERNALS 0
64 #undef CYTHON_USE_UNICODE_INTERNALS
65 #define CYTHON_USE_UNICODE_INTERNALS 0
66 #undef CYTHON_USE_UNICODE_WRITER
67 #define CYTHON_USE_UNICODE_WRITER 0
68 #undef CYTHON_USE_PYLONG_INTERNALS
69 #define CYTHON_USE_PYLONG_INTERNALS 0
70 #undef CYTHON_AVOID_BORROWED_REFS
71 #define CYTHON_AVOID_BORROWED_REFS 1
72 #undef CYTHON_ASSUME_SAFE_MACROS
73 #define CYTHON_ASSUME_SAFE_MACROS 0
74 #undef CYTHON_UNPACK_METHODS
75 #define CYTHON_UNPACK_METHODS 0
76 #undef CYTHON_FAST_THREAD_STATE
77 #define CYTHON_FAST_THREAD_STATE 0
78 #undef CYTHON_FAST_PYCALL
79 #define CYTHON_FAST_PYCALL 0
80 #undef CYTHON_PEP489_MULTI_PHASE_INIT
81 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
82 #undef CYTHON_USE_TP_FINALIZE
83 #define CYTHON_USE_TP_FINALIZE 0
84 #undef CYTHON_USE_DICT_VERSIONS
85 #define CYTHON_USE_DICT_VERSIONS 0
86 #undef CYTHON_USE_EXC_INFO_STACK
87 #define CYTHON_USE_EXC_INFO_STACK 0
88 #elif defined(PYSTON_VERSION)
89 #define CYTHON_COMPILING_IN_PYPY 0
90 #define CYTHON_COMPILING_IN_PYSTON 1
91 #define CYTHON_COMPILING_IN_CPYTHON 0
92 #ifndef CYTHON_USE_TYPE_SLOTS
93 #define CYTHON_USE_TYPE_SLOTS 1
95 #undef CYTHON_USE_PYTYPE_LOOKUP
96 #define CYTHON_USE_PYTYPE_LOOKUP 0
97 #undef CYTHON_USE_ASYNC_SLOTS
98 #define CYTHON_USE_ASYNC_SLOTS 0
99 #undef CYTHON_USE_PYLIST_INTERNALS
100 #define CYTHON_USE_PYLIST_INTERNALS 0
101 #ifndef CYTHON_USE_UNICODE_INTERNALS
102 #define CYTHON_USE_UNICODE_INTERNALS 1
104 #undef CYTHON_USE_UNICODE_WRITER
105 #define CYTHON_USE_UNICODE_WRITER 0
106 #undef CYTHON_USE_PYLONG_INTERNALS
107 #define CYTHON_USE_PYLONG_INTERNALS 0
108 #ifndef CYTHON_AVOID_BORROWED_REFS
109 #define CYTHON_AVOID_BORROWED_REFS 0
111 #ifndef CYTHON_ASSUME_SAFE_MACROS
112 #define CYTHON_ASSUME_SAFE_MACROS 1
114 #ifndef CYTHON_UNPACK_METHODS
115 #define CYTHON_UNPACK_METHODS 1
117 #undef CYTHON_FAST_THREAD_STATE
118 #define CYTHON_FAST_THREAD_STATE 0
119 #undef CYTHON_FAST_PYCALL
120 #define CYTHON_FAST_PYCALL 0
121 #undef CYTHON_PEP489_MULTI_PHASE_INIT
122 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
123 #undef CYTHON_USE_TP_FINALIZE
124 #define CYTHON_USE_TP_FINALIZE 0
125 #undef CYTHON_USE_DICT_VERSIONS
126 #define CYTHON_USE_DICT_VERSIONS 0
127 #undef CYTHON_USE_EXC_INFO_STACK
128 #define CYTHON_USE_EXC_INFO_STACK 0
130 #define CYTHON_COMPILING_IN_PYPY 0
131 #define CYTHON_COMPILING_IN_PYSTON 0
132 #define CYTHON_COMPILING_IN_CPYTHON 1
133 #ifndef CYTHON_USE_TYPE_SLOTS
134 #define CYTHON_USE_TYPE_SLOTS 1
136 #if PY_VERSION_HEX < 0x02070000
137 #undef CYTHON_USE_PYTYPE_LOOKUP
138 #define CYTHON_USE_PYTYPE_LOOKUP 0
139 #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
140 #define CYTHON_USE_PYTYPE_LOOKUP 1
142 #if PY_MAJOR_VERSION < 3
143 #undef CYTHON_USE_ASYNC_SLOTS
144 #define CYTHON_USE_ASYNC_SLOTS 0
145 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
146 #define CYTHON_USE_ASYNC_SLOTS 1
148 #if PY_VERSION_HEX < 0x02070000
149 #undef CYTHON_USE_PYLONG_INTERNALS
150 #define CYTHON_USE_PYLONG_INTERNALS 0
151 #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
152 #define CYTHON_USE_PYLONG_INTERNALS 1
154 #ifndef CYTHON_USE_PYLIST_INTERNALS
155 #define CYTHON_USE_PYLIST_INTERNALS 1
157 #ifndef CYTHON_USE_UNICODE_INTERNALS
158 #define CYTHON_USE_UNICODE_INTERNALS 1
160 #if PY_VERSION_HEX < 0x030300F0
161 #undef CYTHON_USE_UNICODE_WRITER
162 #define CYTHON_USE_UNICODE_WRITER 0
163 #elif !defined(CYTHON_USE_UNICODE_WRITER)
164 #define CYTHON_USE_UNICODE_WRITER 1
166 #ifndef CYTHON_AVOID_BORROWED_REFS
167 #define CYTHON_AVOID_BORROWED_REFS 0
169 #ifndef CYTHON_ASSUME_SAFE_MACROS
170 #define CYTHON_ASSUME_SAFE_MACROS 1
172 #ifndef CYTHON_UNPACK_METHODS
173 #define CYTHON_UNPACK_METHODS 1
175 #ifndef CYTHON_FAST_THREAD_STATE
176 #define CYTHON_FAST_THREAD_STATE 1
178 #ifndef CYTHON_FAST_PYCALL
179 #define CYTHON_FAST_PYCALL 1
181 #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
182 #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
184 #ifndef CYTHON_USE_TP_FINALIZE
185 #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
187 #ifndef CYTHON_USE_DICT_VERSIONS
188 #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
190 #ifndef CYTHON_USE_EXC_INFO_STACK
191 #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
194 #if !defined(CYTHON_FAST_PYCCALL)
195 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
197 #if CYTHON_USE_PYLONG_INTERNALS
198 #include "longintrepr.h"
203 enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P ==
sizeof(
void*)) };
206 #ifndef __has_attribute
207 #define __has_attribute(x) 0
209 #ifndef __has_cpp_attribute
210 #define __has_cpp_attribute(x) 0
212 #ifndef CYTHON_RESTRICT
213 #if defined(__GNUC__)
214 #define CYTHON_RESTRICT __restrict__
215 #elif defined(_MSC_VER) && _MSC_VER >= 1400
216 #define CYTHON_RESTRICT __restrict
217 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
218 #define CYTHON_RESTRICT restrict
220 #define CYTHON_RESTRICT
223 #ifndef CYTHON_UNUSED
224 # if defined(__GNUC__)
225 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
226 # define CYTHON_UNUSED __attribute__ ((__unused__))
228 # define CYTHON_UNUSED
230 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
231 # define CYTHON_UNUSED __attribute__ ((__unused__))
233 # define CYTHON_UNUSED
236 #ifndef CYTHON_MAYBE_UNUSED_VAR
237 # if defined(__cplusplus)
238 template<
class T>
void CYTHON_MAYBE_UNUSED_VAR(
const T& ) { }
240 # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
243 #ifndef CYTHON_NCP_UNUSED
244 # if CYTHON_COMPILING_IN_CPYTHON
245 # define CYTHON_NCP_UNUSED
247 # define CYTHON_NCP_UNUSED CYTHON_UNUSED
250 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
252 #ifndef _MSC_STDINT_H_
254 typedef unsigned char uint8_t;
255 typedef unsigned int uint32_t;
257 typedef unsigned __int8 uint8_t;
258 typedef unsigned __int32 uint32_t;
264 #ifndef CYTHON_FALLTHROUGH
265 #if defined(__cplusplus) && __cplusplus >= 201103L
266 #if __has_cpp_attribute(fallthrough)
267 #define CYTHON_FALLTHROUGH [[fallthrough]]
268 #elif __has_cpp_attribute(clang::fallthrough)
269 #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
270 #elif __has_cpp_attribute(gnu::fallthrough)
271 #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
274 #ifndef CYTHON_FALLTHROUGH
275 #if __has_attribute(fallthrough)
276 #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
278 #define CYTHON_FALLTHROUGH
281 #if defined(__clang__ ) && defined(__apple_build_version__)
282 #if __apple_build_version__ < 7000000
283 #undef CYTHON_FALLTHROUGH
284 #define CYTHON_FALLTHROUGH
289 #ifndef CYTHON_INLINE
290 #if defined(__clang__)
291 #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
292 #elif defined(__GNUC__)
293 #define CYTHON_INLINE __inline__
294 #elif defined(_MSC_VER)
295 #define CYTHON_INLINE __inline
296 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
297 #define CYTHON_INLINE inline
299 #define CYTHON_INLINE
303 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
304 #define Py_OptimizeFlag 0
306 #define __PYX_BUILD_PY_SSIZE_T "n"
307 #define CYTHON_FORMAT_SSIZE_T "z"
308 #if PY_MAJOR_VERSION < 3
309 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
310 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
311 PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
312 #define __Pyx_DefaultClassType PyClass_Type
314 #define __Pyx_BUILTIN_MODULE_NAME "builtins"
315 #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
316 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
317 PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
319 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
320 PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
322 #define __Pyx_DefaultClassType PyType_Type
324 #ifndef Py_TPFLAGS_CHECKTYPES
325 #define Py_TPFLAGS_CHECKTYPES 0
327 #ifndef Py_TPFLAGS_HAVE_INDEX
328 #define Py_TPFLAGS_HAVE_INDEX 0
330 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
331 #define Py_TPFLAGS_HAVE_NEWBUFFER 0
333 #ifndef Py_TPFLAGS_HAVE_FINALIZE
334 #define Py_TPFLAGS_HAVE_FINALIZE 0
336 #ifndef METH_STACKLESS
337 #define METH_STACKLESS 0
339 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
340 #ifndef METH_FASTCALL
341 #define METH_FASTCALL 0x80
343 typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *
self, PyObject *
const *args, Py_ssize_t nargs);
344 typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *
self, PyObject *
const *args,
345 Py_ssize_t nargs, PyObject *kwnames);
347 #define __Pyx_PyCFunctionFast _PyCFunctionFast
348 #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
350 #if CYTHON_FAST_PYCCALL
351 #define __Pyx_PyFastCFunction_Check(func)\
352 ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
354 #define __Pyx_PyFastCFunction_Check(func) 0
356 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
357 #define PyObject_Malloc(s) PyMem_Malloc(s)
358 #define PyObject_Free(p) PyMem_Free(p)
359 #define PyObject_Realloc(p) PyMem_Realloc(p)
361 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
362 #define PyMem_RawMalloc(n) PyMem_Malloc(n)
363 #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n)
364 #define PyMem_RawFree(p) PyMem_Free(p)
366 #if CYTHON_COMPILING_IN_PYSTON
367 #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
368 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
370 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
371 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
373 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
374 #define __Pyx_PyThreadState_Current PyThreadState_GET()
375 #elif PY_VERSION_HEX >= 0x03060000
376 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
377 #elif PY_VERSION_HEX >= 0x03000000
378 #define __Pyx_PyThreadState_Current PyThreadState_GET()
380 #define __Pyx_PyThreadState_Current _PyThreadState_Current
382 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
383 #include "pythread.h"
384 #define Py_tss_NEEDS_INIT 0
385 typedef int Py_tss_t;
386 static CYTHON_INLINE
int PyThread_tss_create(Py_tss_t *key) {
387 *key = PyThread_create_key();
390 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(
void) {
391 Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(
sizeof(Py_tss_t));
392 *key = Py_tss_NEEDS_INIT;
395 static CYTHON_INLINE
void PyThread_tss_free(Py_tss_t *key) {
398 static CYTHON_INLINE
int PyThread_tss_is_created(Py_tss_t *key) {
399 return *key != Py_tss_NEEDS_INIT;
401 static CYTHON_INLINE
void PyThread_tss_delete(Py_tss_t *key) {
402 PyThread_delete_key(*key);
403 *key = Py_tss_NEEDS_INIT;
405 static CYTHON_INLINE
int PyThread_tss_set(Py_tss_t *key,
void *value) {
406 return PyThread_set_key_value(*key, value);
408 static CYTHON_INLINE
void * PyThread_tss_get(Py_tss_t *key) {
409 return PyThread_get_key_value(*key);
412 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
413 #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
415 #define __Pyx_PyDict_NewPresized(n) PyDict_New()
417 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
418 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
419 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
421 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
422 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
424 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
425 #define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
427 #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
429 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
430 #define CYTHON_PEP393_ENABLED 1
431 #if defined(PyUnicode_IS_READY)
432 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
433 0 : _PyUnicode_Ready((PyObject *)(op)))
435 #define __Pyx_PyUnicode_READY(op) (0)
437 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
438 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
439 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
440 #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
441 #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
442 #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
443 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
444 #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
445 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
446 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
448 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
451 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u))
454 #define CYTHON_PEP393_ENABLED 0
455 #define PyUnicode_1BYTE_KIND 1
456 #define PyUnicode_2BYTE_KIND 2
457 #define PyUnicode_4BYTE_KIND 4
458 #define __Pyx_PyUnicode_READY(op) (0)
459 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
460 #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
461 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
462 #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
463 #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
464 #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
465 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
466 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
468 #if CYTHON_COMPILING_IN_PYPY
469 #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
470 #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
472 #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
473 #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
474 PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
476 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
477 #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
479 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
480 #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
482 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
483 #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
485 #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
486 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
487 #if PY_MAJOR_VERSION >= 3
488 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
490 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
492 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
493 #define PyObject_ASCII(o) PyObject_Repr(o)
495 #if PY_MAJOR_VERSION >= 3
496 #define PyBaseString_Type PyUnicode_Type
497 #define PyStringObject PyUnicodeObject
498 #define PyString_Type PyUnicode_Type
499 #define PyString_Check PyUnicode_Check
500 #define PyString_CheckExact PyUnicode_CheckExact
501 #ifndef PyObject_Unicode
502 #define PyObject_Unicode PyObject_Str
505 #if PY_MAJOR_VERSION >= 3
506 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
507 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
509 #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
510 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
512 #ifndef PySet_CheckExact
513 #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
515 #if PY_VERSION_HEX >= 0x030900A4
516 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
517 #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
519 #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
520 #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
522 #if CYTHON_ASSUME_SAFE_MACROS
523 #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
525 #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
527 #if PY_MAJOR_VERSION >= 3
528 #define PyIntObject PyLongObject
529 #define PyInt_Type PyLong_Type
530 #define PyInt_Check(op) PyLong_Check(op)
531 #define PyInt_CheckExact(op) PyLong_CheckExact(op)
532 #define PyInt_FromString PyLong_FromString
533 #define PyInt_FromUnicode PyLong_FromUnicode
534 #define PyInt_FromLong PyLong_FromLong
535 #define PyInt_FromSize_t PyLong_FromSize_t
536 #define PyInt_FromSsize_t PyLong_FromSsize_t
537 #define PyInt_AsLong PyLong_AsLong
538 #define PyInt_AS_LONG PyLong_AS_LONG
539 #define PyInt_AsSsize_t PyLong_AsSsize_t
540 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
541 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
542 #define PyNumber_Int PyNumber_Long
544 #if PY_MAJOR_VERSION >= 3
545 #define PyBoolObject PyLongObject
547 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
548 #ifndef PyUnicode_InternFromString
549 #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
552 #if PY_VERSION_HEX < 0x030200A4
553 typedef long Py_hash_t;
554 #define __Pyx_PyInt_FromHash_t PyInt_FromLong
555 #define __Pyx_PyInt_AsHash_t PyInt_AsLong
557 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
558 #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
560 #if PY_MAJOR_VERSION >= 3
561 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
563 #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
565 #if CYTHON_USE_ASYNC_SLOTS
566 #if PY_VERSION_HEX >= 0x030500B1
567 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
568 #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
570 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
573 #define __Pyx_PyType_AsAsync(obj) NULL
575 #ifndef __Pyx_PyAsyncMethodsStruct
580 } __Pyx_PyAsyncMethodsStruct;
583 #if defined(WIN32) || defined(MS_WINDOWS)
584 #define _USE_MATH_DEFINES
588 #define __PYX_NAN() ((float) NAN)
590 static CYTHON_INLINE
float __PYX_NAN() {
592 memset(&value, 0xFF,
sizeof(value));
596 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
597 #define __Pyx_truncl trunc
599 #define __Pyx_truncl truncl
602 #define __PYX_MARK_ERR_POS(f_index, lineno) \
603 { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
604 #define __PYX_ERR(f_index, lineno, Ln_error) \
605 { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
607 #ifndef __PYX_EXTERN_C
609 #define __PYX_EXTERN_C extern "C"
611 #define __PYX_EXTERN_C extern
615 #define __PYX_HAVE__csmoothers
616 #define __PYX_HAVE_API__csmoothers
620 #include "numpy/arrayobject.h"
621 #include "numpy/ndarrayobject.h"
622 #include "numpy/ndarraytypes.h"
623 #include "numpy/arrayscalars.h"
624 #include "numpy/ufuncobject.h"
630 #include "pythread.h"
637 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
638 #define CYTHON_WITHOUT_ASSERTIONS
641 typedef struct {PyObject **p;
const char *
s;
const Py_ssize_t
n;
const char* encoding;
642 const char is_unicode;
const char is_str;
const char intern; } __Pyx_StringTabEntry;
644 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
645 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
646 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
647 #define __PYX_DEFAULT_STRING_ENCODING ""
648 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
649 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
650 #define __Pyx_uchar_cast(c) ((unsigned char)c)
651 #define __Pyx_long_cast(x) ((long)x)
652 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
653 (sizeof(type) < sizeof(Py_ssize_t)) ||\
654 (sizeof(type) > sizeof(Py_ssize_t) &&\
655 likely(v < (type)PY_SSIZE_T_MAX ||\
656 v == (type)PY_SSIZE_T_MAX) &&\
657 (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
658 v == (type)PY_SSIZE_T_MIN))) ||\
659 (sizeof(type) == sizeof(Py_ssize_t) &&\
660 (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
661 v == (type)PY_SSIZE_T_MAX))) )
662 static CYTHON_INLINE
int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
663 return (
size_t) i < (size_t) limit;
665 #if defined (__cplusplus) && __cplusplus >= 201103L
667 #define __Pyx_sst_abs(value) std::abs(value)
668 #elif SIZEOF_INT >= SIZEOF_SIZE_T
669 #define __Pyx_sst_abs(value) abs(value)
670 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
671 #define __Pyx_sst_abs(value) labs(value)
672 #elif defined (_MSC_VER)
673 #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
674 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
675 #define __Pyx_sst_abs(value) llabs(value)
676 #elif defined (__GNUC__)
677 #define __Pyx_sst_abs(value) __builtin_llabs(value)
679 #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
681 static CYTHON_INLINE
const char* __Pyx_PyObject_AsString(PyObject*);
682 static CYTHON_INLINE
const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
683 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
684 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
685 #define __Pyx_PyBytes_FromString PyBytes_FromString
686 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
687 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(
const char*);
688 #if PY_MAJOR_VERSION < 3
689 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
690 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
692 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
693 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
695 #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
696 #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
697 #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
698 #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
699 #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
700 #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
701 #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
702 #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
703 #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
704 #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
705 #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
706 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
707 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
708 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
709 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
710 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
711 static CYTHON_INLINE
size_t __Pyx_Py_UNICODE_strlen(
const Py_UNICODE *
u) {
712 const Py_UNICODE *u_end =
u;
714 return (
size_t)(u_end -
u - 1);
716 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
717 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
718 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
719 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
720 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
721 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(
long b);
722 static CYTHON_INLINE
int __Pyx_PyObject_IsTrue(PyObject*);
723 static CYTHON_INLINE
int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
724 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
725 #define __Pyx_PySequence_Tuple(obj)\
726 (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
727 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
728 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(
size_t);
729 #if CYTHON_ASSUME_SAFE_MACROS
730 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
732 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
734 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
735 #if PY_MAJOR_VERSION >= 3
736 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
738 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
740 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
741 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
742 static int __Pyx_sys_getdefaultencoding_not_ascii;
743 static int __Pyx_init_sys_getdefaultencoding_params(
void) {
745 PyObject* default_encoding = NULL;
746 PyObject* ascii_chars_u = NULL;
747 PyObject* ascii_chars_b = NULL;
748 const char* default_encoding_c;
749 sys = PyImport_ImportModule(
"sys");
751 default_encoding = PyObject_CallMethod(sys, (
char*)
"getdefaultencoding", NULL);
753 if (!default_encoding)
goto bad;
754 default_encoding_c = PyBytes_AsString(default_encoding);
755 if (!default_encoding_c)
goto bad;
756 if (strcmp(default_encoding_c,
"ascii") == 0) {
757 __Pyx_sys_getdefaultencoding_not_ascii = 0;
759 char ascii_chars[128];
761 for (
c = 0;
c < 128;
c++) {
764 __Pyx_sys_getdefaultencoding_not_ascii = 1;
765 ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
766 if (!ascii_chars_u)
goto bad;
767 ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
768 if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
771 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
775 Py_DECREF(ascii_chars_u);
776 Py_DECREF(ascii_chars_b);
778 Py_DECREF(default_encoding);
781 Py_XDECREF(default_encoding);
782 Py_XDECREF(ascii_chars_u);
783 Py_XDECREF(ascii_chars_b);
787 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
788 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
790 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
791 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
792 static char* __PYX_DEFAULT_STRING_ENCODING;
793 static int __Pyx_init_sys_getdefaultencoding_params(
void) {
795 PyObject* default_encoding = NULL;
796 char* default_encoding_c;
797 sys = PyImport_ImportModule(
"sys");
799 default_encoding = PyObject_CallMethod(sys, (
char*) (
const char*)
"getdefaultencoding", NULL);
801 if (!default_encoding)
goto bad;
802 default_encoding_c = PyBytes_AsString(default_encoding);
803 if (!default_encoding_c)
goto bad;
804 __PYX_DEFAULT_STRING_ENCODING = (
char*) malloc(strlen(default_encoding_c) + 1);
805 if (!__PYX_DEFAULT_STRING_ENCODING)
goto bad;
806 strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
807 Py_DECREF(default_encoding);
810 Py_XDECREF(default_encoding);
818 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
819 #define likely(x) __builtin_expect(!!(x), 1)
820 #define unlikely(x) __builtin_expect(!!(x), 0)
822 #define likely(x) (x)
823 #define unlikely(x) (x)
825 static CYTHON_INLINE
void __Pyx_pretend_to_initialize(
void* ptr) { (void)ptr; }
827 static PyObject *__pyx_m = NULL;
828 static PyObject *__pyx_d;
829 static PyObject *__pyx_b;
830 static PyObject *__pyx_cython_runtime = NULL;
831 static PyObject *__pyx_empty_tuple;
832 static PyObject *__pyx_empty_bytes;
833 static PyObject *__pyx_empty_unicode;
834 static int __pyx_lineno;
835 static int __pyx_clineno = 0;
836 static const char * __pyx_cfilenm= __FILE__;
837 static const char *__pyx_filename;
840 #if !defined(CYTHON_CCOMPLEX)
841 #if defined(__cplusplus)
842 #define CYTHON_CCOMPLEX 1
843 #elif defined(_Complex_I)
844 #define CYTHON_CCOMPLEX 1
846 #define CYTHON_CCOMPLEX 0
856 #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
858 #define _Complex_I 1.0fj
862 static const char *__pyx_f[] = {
863 "proteus/csmoothers.pyx",
867 "proteus/superluWrappers.pxd",
870 struct __pyx_memoryview_obj;
872 struct __pyx_memoryview_obj *memview;
875 Py_ssize_t strides[8];
876 Py_ssize_t suboffsets[8];
877 } __Pyx_memviewslice;
878 #define __Pyx_MemoryView_Len(m) (m.shape[0])
881 #include <pythread.h>
882 #ifndef CYTHON_ATOMICS
883 #define CYTHON_ATOMICS 1
885 #define __pyx_atomic_int_type int
886 #if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 ||\
887 (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL >= 2)) &&\
889 #define __pyx_atomic_incr_aligned(value, lock) __sync_fetch_and_add(value, 1)
890 #define __pyx_atomic_decr_aligned(value, lock) __sync_fetch_and_sub(value, 1)
891 #ifdef __PYX_DEBUG_ATOMICS
892 #warning "Using GNU atomics"
894 #elif CYTHON_ATOMICS && defined(_MSC_VER) && 0
896 #undef __pyx_atomic_int_type
897 #define __pyx_atomic_int_type LONG
898 #define __pyx_atomic_incr_aligned(value, lock) InterlockedIncrement(value)
899 #define __pyx_atomic_decr_aligned(value, lock) InterlockedDecrement(value)
900 #ifdef __PYX_DEBUG_ATOMICS
901 #pragma message ("Using MSVC atomics")
903 #elif CYTHON_ATOMICS && (defined(__ICC) || defined(__INTEL_COMPILER)) && 0
904 #define __pyx_atomic_incr_aligned(value, lock) _InterlockedIncrement(value)
905 #define __pyx_atomic_decr_aligned(value, lock) _InterlockedDecrement(value)
906 #ifdef __PYX_DEBUG_ATOMICS
907 #warning "Using Intel atomics"
910 #undef CYTHON_ATOMICS
911 #define CYTHON_ATOMICS 0
912 #ifdef __PYX_DEBUG_ATOMICS
913 #warning "Not using atomics"
916 typedef volatile __pyx_atomic_int_type __pyx_atomic_int;
918 #define __pyx_add_acquisition_count(memview)\
919 __pyx_atomic_incr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
920 #define __pyx_sub_acquisition_count(memview)\
921 __pyx_atomic_decr_aligned(__pyx_get_slice_count_pointer(memview), memview->lock)
923 #define __pyx_add_acquisition_count(memview)\
924 __pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
925 #define __pyx_sub_acquisition_count(memview)\
926 __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
930 #ifndef __PYX_FORCE_INIT_THREADS
931 #define __PYX_FORCE_INIT_THREADS 0
935 #define __Pyx_PyGILState_Ensure PyGILState_Ensure
936 #define __Pyx_PyGILState_Release PyGILState_Release
937 #define __Pyx_FastGIL_Remember()
938 #define __Pyx_FastGIL_Forget()
939 #define __Pyx_FastGilFuncInit()
942 #define IS_UNSIGNED(type) (((type) -1) > 0)
943 struct __Pyx_StructField_;
944 #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
947 struct __Pyx_StructField_* fields;
955 typedef struct __Pyx_StructField_ {
956 __Pyx_TypeInfo* type;
961 __Pyx_StructField* field;
962 size_t parent_offset;
963 } __Pyx_BufFmt_StackElem;
965 __Pyx_StructField root;
966 __Pyx_BufFmt_StackElem* head;
968 size_t new_count, enc_count;
969 size_t struct_alignment;
975 } __Pyx_BufFmt_Context;
985 typedef npy_int8 __pyx_t_5numpy_int8_t;
994 typedef npy_int16 __pyx_t_5numpy_int16_t;
1003 typedef npy_int32 __pyx_t_5numpy_int32_t;
1012 typedef npy_int64 __pyx_t_5numpy_int64_t;
1021 typedef npy_uint8 __pyx_t_5numpy_uint8_t;
1030 typedef npy_uint16 __pyx_t_5numpy_uint16_t;
1039 typedef npy_uint32 __pyx_t_5numpy_uint32_t;
1048 typedef npy_uint64 __pyx_t_5numpy_uint64_t;
1057 typedef npy_float32 __pyx_t_5numpy_float32_t;
1066 typedef npy_float64 __pyx_t_5numpy_float64_t;
1075 typedef npy_long __pyx_t_5numpy_int_t;
1084 typedef npy_longlong __pyx_t_5numpy_long_t;
1093 typedef npy_longlong __pyx_t_5numpy_longlong_t;
1102 typedef npy_ulong __pyx_t_5numpy_uint_t;
1111 typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
1120 typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
1129 typedef npy_intp __pyx_t_5numpy_intp_t;
1138 typedef npy_uintp __pyx_t_5numpy_uintp_t;
1147 typedef npy_double __pyx_t_5numpy_float_t;
1156 typedef npy_double __pyx_t_5numpy_double_t;
1165 typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
1174 typedef int __pyx_t_10csmoothers_PROTEUS_LAPACK_INTEGER;
1178 typedef ::std::complex< float > __pyx_t_float_complex;
1180 typedef float _Complex __pyx_t_float_complex;
1183 typedef struct {
float real, imag; } __pyx_t_float_complex;
1185 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(
float,
float);
1190 typedef ::std::complex< double > __pyx_t_double_complex;
1192 typedef double _Complex __pyx_t_double_complex;
1195 typedef struct {
double real, imag; } __pyx_t_double_complex;
1197 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(
double,
double);
1201 struct __pyx_obj_7proteus_15superluWrappers_cSparseMatrix;
1202 struct __pyx_obj_10csmoothers_cASMFactor;
1203 struct __pyx_obj_10csmoothers_cBASMFactor;
1204 struct __pyx_array_obj;
1205 struct __pyx_MemviewEnum_obj;
1206 struct __pyx_memoryview_obj;
1207 struct __pyx_memoryviewslice_obj;
1216 typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
1225 typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
1234 typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
1243 typedef npy_cdouble __pyx_t_5numpy_complex_t;
1244 struct __pyx_t_7proteus_15superluWrappers__NRformat;
1253 struct __pyx_t_7proteus_15superluWrappers__NRformat {
1254 __pyx_t_5numpy_int32_t
nnz;
1255 __pyx_t_5numpy_float64_t *nzval;
1256 __pyx_t_5numpy_int32_t *colind;
1257 __pyx_t_5numpy_int32_t *rowptr;
1267 typedef __Pyx_memviewslice __pyx_t_10csmoothers_DDATA;
1276 typedef __Pyx_memviewslice __pyx_t_10csmoothers_IDATA;
1285 typedef SuperMatrix __pyx_t_10csmoothers_SuperMatrix;
1294 struct __pyx_obj_7proteus_15superluWrappers_cSparseMatrix {
1296 __pyx_t_5numpy_int32_t dim[2];
1297 struct __pyx_t_7proteus_15superluWrappers__NRformat A;
1308 struct __pyx_obj_10csmoothers_cASMFactor {
1313 double **subdomain_L;
1314 double **subdomain_R;
1315 double **subdomain_dX;
1316 __pyx_t_10csmoothers_PROTEUS_LAPACK_INTEGER **subdomain_pivots;
1327 struct __pyx_obj_10csmoothers_cBASMFactor {
1333 double **subdomain_L;
1334 double **subdomain_R;
1335 double **subdomain_dX;
1336 __pyx_t_10csmoothers_PROTEUS_LAPACK_INTEGER **subdomain_pivots;
1337 __pyx_t_10csmoothers_PROTEUS_LAPACK_INTEGER **subdomain_col_pivots;
1348 struct __pyx_array_obj {
1350 struct __pyx_vtabstruct_array *__pyx_vtab;
1356 Py_ssize_t *_strides;
1357 Py_ssize_t itemsize;
1360 void (*callback_free_data)(
void *);
1362 int dtype_is_object;
1373 struct __pyx_MemviewEnum_obj {
1386 struct __pyx_memoryview_obj {
1388 struct __pyx_vtabstruct_memoryview *__pyx_vtab;
1391 PyObject *_array_interface;
1392 PyThread_type_lock lock;
1393 __pyx_atomic_int acquisition_count[2];
1394 __pyx_atomic_int *acquisition_count_aligned_p;
1397 int dtype_is_object;
1398 __Pyx_TypeInfo *typeinfo;
1409 struct __pyx_memoryviewslice_obj {
1410 struct __pyx_memoryview_obj __pyx_base;
1411 __Pyx_memviewslice from_slice;
1412 PyObject *from_object;
1413 PyObject *(*to_object_func)(
char *);
1414 int (*to_dtype_func)(
char *, PyObject *);
1427 struct __pyx_vtabstruct_array {
1428 PyObject *(*get_memview)(
struct __pyx_array_obj *);
1430 static struct __pyx_vtabstruct_array *__pyx_vtabptr_array;
1441 struct __pyx_vtabstruct_memoryview {
1442 char *(*get_item_pointer)(
struct __pyx_memoryview_obj *, PyObject *);
1443 PyObject *(*is_slice)(
struct __pyx_memoryview_obj *, PyObject *);
1444 PyObject *(*setitem_slice_assignment)(
struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1445 PyObject *(*setitem_slice_assign_scalar)(
struct __pyx_memoryview_obj *,
struct __pyx_memoryview_obj *, PyObject *);
1446 PyObject *(*setitem_indexed)(
struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1447 PyObject *(*convert_item_to_object)(
struct __pyx_memoryview_obj *,
char *);
1448 PyObject *(*assign_item_from_object)(
struct __pyx_memoryview_obj *,
char *, PyObject *);
1450 static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview;
1461 struct __pyx_vtabstruct__memoryviewslice {
1462 struct __pyx_vtabstruct_memoryview __pyx_base;
1464 static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;
1468 #ifndef CYTHON_REFNANNY
1469 #define CYTHON_REFNANNY 0
1473 void (*INCREF)(
void*, PyObject*, int);
1474 void (*DECREF)(
void*, PyObject*, int);
1475 void (*GOTREF)(
void*, PyObject*, int);
1476 void (*GIVEREF)(
void*, PyObject*, int);
1477 void* (*SetupContext)(
const char*, int,
const char*);
1478 void (*FinishContext)(
void**);
1479 } __Pyx_RefNannyAPIStruct;
1480 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1481 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(
const char *modname);
1482 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1484 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1486 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1487 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1488 PyGILState_Release(__pyx_gilstate_save);\
1490 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1493 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1494 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1496 #define __Pyx_RefNannyFinishContext()\
1497 __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1498 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1499 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1500 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1501 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1502 #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1503 #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1504 #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1505 #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1507 #define __Pyx_RefNannyDeclarations
1508 #define __Pyx_RefNannySetupContext(name, acquire_gil)
1509 #define __Pyx_RefNannyFinishContext()
1510 #define __Pyx_INCREF(r) Py_INCREF(r)
1511 #define __Pyx_DECREF(r) Py_DECREF(r)
1512 #define __Pyx_GOTREF(r)
1513 #define __Pyx_GIVEREF(r)
1514 #define __Pyx_XINCREF(r) Py_XINCREF(r)
1515 #define __Pyx_XDECREF(r) Py_XDECREF(r)
1516 #define __Pyx_XGOTREF(r)
1517 #define __Pyx_XGIVEREF(r)
1519 #define __Pyx_XDECREF_SET(r, v) do {\
1520 PyObject *tmp = (PyObject *) r;\
1521 r = v; __Pyx_XDECREF(tmp);\
1523 #define __Pyx_DECREF_SET(r, v) do {\
1524 PyObject *tmp = (PyObject *) r;\
1525 r = v; __Pyx_DECREF(tmp);\
1527 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1528 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1531 #if CYTHON_USE_TYPE_SLOTS
1532 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1534 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1538 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1541 static void __Pyx_RaiseArgtupleInvalid(
const char* func_name,
int exact,
1542 Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1545 static void __Pyx_RaiseDoubleKeywordsError(
const char* func_name, PyObject* kw_name);
1548 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1549 PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1550 const char* function_name);
1553 #if CYTHON_USE_TYPE_SLOTS
1554 #define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL)
1555 static CYTHON_INLINE
int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value);
1557 #define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n)
1558 #define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
1562 #if CYTHON_FAST_PYCCALL
1563 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1565 #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
1569 #if CYTHON_FAST_PYCALL
1570 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1571 __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1572 #if 1 || PY_VERSION_HEX < 0x030600B1
1573 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1575 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1577 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1578 (sizeof(char [1 - 2*!(cond)]) - 1)
1579 #ifndef Py_MEMBER_SIZE
1580 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1582 static size_t __pyx_pyframe_localsplus_offset = 0;
1583 #include "frameobject.h"
1584 #define __Pxy_PyFrame_Initialize_Offsets()\
1585 ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1586 (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1587 #define __Pyx_PyFrame_GetLocalsplus(frame)\
1588 (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1592 #if CYTHON_COMPILING_IN_CPYTHON
1593 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1595 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1599 #if CYTHON_COMPILING_IN_CPYTHON
1600 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1604 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1607 #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
1608 ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
1609 __Pyx__ArgTypeTest(obj, type, name, exact))
1610 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type,
const char *name,
int exact);
1613 #if CYTHON_FAST_THREAD_STATE
1614 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1615 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1616 #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
1618 #define __Pyx_PyThreadState_declare
1619 #define __Pyx_PyThreadState_assign
1620 #define __Pyx_PyErr_Occurred() PyErr_Occurred()
1624 #if CYTHON_FAST_THREAD_STATE
1625 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1626 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1627 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1628 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1629 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1630 static CYTHON_INLINE
void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1631 static CYTHON_INLINE
void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1632 #if CYTHON_COMPILING_IN_CPYTHON
1633 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1635 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1638 #define __Pyx_PyErr_Clear() PyErr_Clear()
1639 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1640 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1641 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1642 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1643 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1644 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1645 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1649 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1652 static CYTHON_INLINE
int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1655 #define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d
1656 #define __Pyx_MEMVIEW_DIRECT 1
1657 #define __Pyx_MEMVIEW_PTR 2
1658 #define __Pyx_MEMVIEW_FULL 4
1659 #define __Pyx_MEMVIEW_CONTIG 8
1660 #define __Pyx_MEMVIEW_STRIDED 16
1661 #define __Pyx_MEMVIEW_FOLLOW 32
1662 #define __Pyx_IS_C_CONTIG 1
1663 #define __Pyx_IS_F_CONTIG 2
1664 static int __Pyx_init_memviewslice(
1665 struct __pyx_memoryview_obj *memview,
1667 __Pyx_memviewslice *memviewslice,
1668 int memview_is_new_reference);
1669 static CYTHON_INLINE
int __pyx_add_acquisition_count_locked(
1670 __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
1671 static CYTHON_INLINE
int __pyx_sub_acquisition_count_locked(
1672 __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
1673 #define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p)
1674 #define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview))
1675 #define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__)
1676 #define __PYX_XDEC_MEMVIEW(slice, have_gil) __Pyx_XDEC_MEMVIEW(slice, have_gil, __LINE__)
1677 static CYTHON_INLINE
void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *,
int,
int);
1678 static CYTHON_INLINE
void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *,
int,
int);
1681 static void __Pyx_RaiseBufferIndexError(
int axis);
1684 static void __Pyx_WriteUnraisable(
const char *name,
int clineno,
1685 int lineno,
const char *filename,
1686 int full_traceback,
int nogil);
1689 #if CYTHON_USE_EXC_INFO_STACK
1690 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1694 #if CYTHON_FAST_THREAD_STATE
1695 #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1696 static CYTHON_INLINE
void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1697 #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1698 static CYTHON_INLINE
void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1700 #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
1701 #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
1705 #if CYTHON_FAST_THREAD_STATE
1706 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1707 static CYTHON_INLINE
int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1709 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1713 #if CYTHON_FAST_THREAD_STATE
1714 #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
1715 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1717 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1721 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject*
function, PyObject* arg1, PyObject* arg2);
1727 static CYTHON_INLINE
int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2,
int equals);
1730 static CYTHON_INLINE
int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2,
int equals);
1733 #if PY_MAJOR_VERSION >= 3
1734 #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
1736 #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
1740 static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t);
1743 #define UNARY_NEG_WOULD_OVERFLOW(x)\
1744 (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))
1746 static CYTHON_UNUSED
int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
1747 static PyObject *__pyx_array_get_memview(
struct __pyx_array_obj *);
1749 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
1752 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1753 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1754 __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1755 (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1756 __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1757 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1758 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1759 __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1760 (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1761 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1762 int wraparound,
int boundscheck);
1763 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1764 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1765 __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1766 (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1767 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1768 int wraparound,
int boundscheck);
1769 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1770 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1771 int is_list,
int wraparound,
int boundscheck);
1774 #if CYTHON_USE_TYPE_SLOTS
1775 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
1777 #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key)
1781 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(
const char *
s, Py_ssize_t size,
const char *errors) {
1783 return PyUnicode_DecodeUTF16(
s, size, errors, &byteorder);
1785 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(
const char *
s, Py_ssize_t size,
const char *errors) {
1787 return PyUnicode_DecodeUTF16(
s, size, errors, &byteorder);
1789 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(
const char *
s, Py_ssize_t size,
const char *errors) {
1791 return PyUnicode_DecodeUTF16(
s, size, errors, &byteorder);
1795 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
1796 const char* cstring, Py_ssize_t start, Py_ssize_t stop,
1797 const char* encoding,
const char* errors,
1798 PyObject* (*decode_func)(
const char *
s, Py_ssize_t size,
const char *errors));
1801 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
1804 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1805 #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
1806 #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
1807 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1808 (version_var) = __PYX_GET_DICT_VERSION(dict);\
1809 (cache_var) = (value);
1810 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1811 static PY_UINT64_T __pyx_dict_version = 0;\
1812 static PyObject *__pyx_dict_cached_value = NULL;\
1813 if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1814 (VAR) = __pyx_dict_cached_value;\
1816 (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1817 __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1820 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1821 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1822 static CYTHON_INLINE
int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1824 #define __PYX_GET_DICT_VERSION(dict) (0)
1825 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1826 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
1830 #if CYTHON_USE_DICT_VERSIONS
1831 #define __Pyx_GetModuleGlobalName(var, name) {\
1832 static PY_UINT64_T __pyx_dict_version = 0;\
1833 static PyObject *__pyx_dict_cached_value = NULL;\
1834 (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1835 (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1836 __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1838 #define __Pyx_GetModuleGlobalNameUncached(var, name) {\
1839 PY_UINT64_T __pyx_dict_version;\
1840 PyObject *__pyx_dict_cached_value;\
1841 (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1843 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1845 #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1846 #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1847 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1851 static CYTHON_INLINE
void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1854 static CYTHON_INLINE
void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1857 static CYTHON_INLINE
void __Pyx_RaiseNoneNotIterableError(
void);
1860 #if CYTHON_FAST_THREAD_STATE
1861 #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
1862 static CYTHON_INLINE
void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1864 static CYTHON_INLINE
void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
1868 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list,
int level);
1871 #if CYTHON_COMPILING_IN_CPYTHON
1872 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1873 static CYTHON_INLINE
int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1874 static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1875 static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1877 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1878 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1879 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1881 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1883 static CYTHON_UNUSED
int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
1885 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
1886 static CYTHON_INLINE
int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
1887 PyListObject*
L = (PyListObject*) list;
1888 Py_ssize_t len = Py_SIZE(list);
1889 if (likely(
L->allocated > len)) {
1891 PyList_SET_ITEM(list, len, x);
1892 __Pyx_SET_SIZE(list, len + 1);
1895 return PyList_Append(list, x);
1898 #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
1902 #if !CYTHON_COMPILING_IN_PYPY
1903 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2,
long intval,
int inplace,
int zerodivision_check);
1905 #define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
1906 (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
1910 static CYTHON_INLINE
int __Pyx_PyList_Extend(PyObject*
L, PyObject*
v) {
1911 #if CYTHON_COMPILING_IN_CPYTHON
1912 PyObject* none = _PyList_Extend((PyListObject*)
L,
v);
1913 if (unlikely(!none))
1918 return PyList_SetSlice(
L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX,
v);
1923 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
1924 static CYTHON_INLINE
int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
1925 PyListObject*
L = (PyListObject*) list;
1926 Py_ssize_t len = Py_SIZE(list);
1927 if (likely(
L->allocated > len) & likely(len > (
L->allocated >> 1))) {
1929 PyList_SET_ITEM(list, len, x);
1930 __Pyx_SET_SIZE(list, len + 1);
1933 return PyList_Append(list, x);
1936 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
1940 static CYTHON_INLINE
void __Pyx_RaiseUnboundLocalError(
const char *varname);
1943 static CYTHON_INLINE
long __Pyx_div_long(
long,
long);
1946 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1949 static CYTHON_INLINE
int __Pyx_HasAttr(PyObject *, PyObject *);
1952 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1953 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
1955 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
1959 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1960 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
1962 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
1966 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
1969 static int __Pyx_setup_reduce(PyObject* type_obj);
1972 static int __Pyx_SetVtable(PyObject *dict,
void *vtable);
1975 #ifndef __PYX_HAVE_RT_ImportType_proto
1976 #define __PYX_HAVE_RT_ImportType_proto
1977 enum __Pyx_ImportType_CheckSize {
1978 __Pyx_ImportType_CheckSize_Error = 0,
1979 __Pyx_ImportType_CheckSize_Warn = 1,
1980 __Pyx_ImportType_CheckSize_Ignore = 2
1982 static PyTypeObject *__Pyx_ImportType(PyObject* module,
const char *module_name,
const char *class_name,
size_t size,
enum __Pyx_ImportType_CheckSize check_size);
1986 static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);
1989 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
1992 #define __Pyx_CyFunction_USED 1
1993 #define __Pyx_CYFUNCTION_STATICMETHOD 0x01
1994 #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02
1995 #define __Pyx_CYFUNCTION_CCLASS 0x04
1996 #define __Pyx_CyFunction_GetClosure(f)\
1997 (((__pyx_CyFunctionObject *) (f))->func_closure)
1998 #define __Pyx_CyFunction_GetClassObj(f)\
1999 (((__pyx_CyFunctionObject *) (f))->func_classobj)
2000 #define __Pyx_CyFunction_Defaults(type, f)\
2001 ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
2002 #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
2003 ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
2005 PyCFunctionObject func;
2006 #if PY_VERSION_HEX < 0x030500A0
2007 PyObject *func_weakreflist;
2009 PyObject *func_dict;
2010 PyObject *func_name;
2011 PyObject *func_qualname;
2013 PyObject *func_globals;
2014 PyObject *func_code;
2015 PyObject *func_closure;
2016 PyObject *func_classobj;
2018 int defaults_pyobjects;
2019 size_t defaults_size;
2021 PyObject *defaults_tuple;
2022 PyObject *defaults_kwdict;
2023 PyObject *(*defaults_getter)(PyObject *);
2024 PyObject *func_annotations;
2025 } __pyx_CyFunctionObject;
2026 static PyTypeObject *__pyx_CyFunctionType = 0;
2027 #define __Pyx_CyFunction_Check(obj) (__Pyx_TypeCheck(obj, __pyx_CyFunctionType))
2028 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
2029 int flags, PyObject* qualname,
2031 PyObject *module, PyObject *globals,
2033 static CYTHON_INLINE
void *__Pyx_CyFunction_InitDefaults(PyObject *m,
2036 static CYTHON_INLINE
void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
2038 static CYTHON_INLINE
void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
2040 static CYTHON_INLINE
void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
2042 static int __pyx_CyFunction_init(
void);
2045 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
2046 int flags, PyObject* qualname,
2048 PyObject *module, PyObject *globals,
2052 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
2053 #define __Pyx_SetNameInClass(ns, name, value)\
2054 (likely(PyDict_CheckExact(ns)) ? _PyDict_SetItem_KnownHash(ns, name, value, ((PyASCIIObject *) name)->hash) : PyObject_SetItem(ns, name, value))
2055 #elif CYTHON_COMPILING_IN_CPYTHON
2056 #define __Pyx_SetNameInClass(ns, name, value)\
2057 (likely(PyDict_CheckExact(ns)) ? PyDict_SetItem(ns, name, value) : PyObject_SetItem(ns, name, value))
2059 #define __Pyx_SetNameInClass(ns, name, value) PyObject_SetItem(ns, name, value)
2063 static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
2064 PyObject *mkw, PyObject *modname, PyObject *doc);
2065 static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
2066 PyObject *mkw,
int calculate_metaclass,
int allow_py2_metaclass);
2069 #ifdef CYTHON_CLINE_IN_TRACEBACK
2070 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
2072 static int __Pyx_CLineForTraceback(PyThreadState *tstate,
int c_line);
2077 PyCodeObject* code_object;
2079 } __Pyx_CodeObjectCacheEntry;
2080 struct __Pyx_CodeObjectCache {
2083 __Pyx_CodeObjectCacheEntry* entries;
2085 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
2086 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries,
int count,
int code_line);
2087 static PyCodeObject *__pyx_find_code_object(
int code_line);
2088 static void __pyx_insert_code_object(
int code_line, PyCodeObject* code_object);
2091 static void __Pyx_AddTraceback(
const char *funcname,
int c_line,
2092 int py_line,
const char *filename);
2094 #if PY_MAJOR_VERSION < 3
2095 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view,
int flags);
2096 static void __Pyx_ReleaseBuffer(Py_buffer *view);
2098 #define __Pyx_GetBuffer PyObject_GetBuffer
2099 #define __Pyx_ReleaseBuffer PyBuffer_Release
2105 Py_ssize_t shape, strides, suboffsets;
2106 } __Pyx_Buf_DimInfo;
2112 __Pyx_Buffer *rcbuffer;
2114 __Pyx_Buf_DimInfo diminfo[8];
2115 } __Pyx_LocalBuf_ND;
2118 static int __pyx_memviewslice_is_contig(
const __Pyx_memviewslice mvs,
char order,
int ndim);
2121 static int __pyx_slices_overlap(__Pyx_memviewslice *slice1,
2122 __Pyx_memviewslice *slice2,
2123 int ndim,
size_t itemsize);
2126 static CYTHON_INLINE PyObject *__pyx_capsule_create(
void *p,
const char *sig);
2129 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
2130 #define __Pyx_HAS_GCC_DIAGNOSTIC
2134 static CYTHON_INLINE
int __Pyx_Is_Little_Endian(
void);
2137 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx,
const char* ts);
2138 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
2139 __Pyx_BufFmt_StackElem* stack,
2140 __Pyx_TypeInfo* type);
2143 static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
2146 static int __Pyx_ValidateAndInit_memviewslice(
2151 __Pyx_TypeInfo *dtype,
2152 __Pyx_BufFmt_StackElem stack[],
2153 __Pyx_memviewslice *memviewslice,
2154 PyObject *original_obj);
2157 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_double(PyObject *,
int writable_flag);
2160 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_int(PyObject *,
int writable_flag);
2165 #define __Pyx_CREAL(z) ((z).real())
2166 #define __Pyx_CIMAG(z) ((z).imag())
2168 #define __Pyx_CREAL(z) (__real__(z))
2169 #define __Pyx_CIMAG(z) (__imag__(z))
2172 #define __Pyx_CREAL(z) ((z).real)
2173 #define __Pyx_CIMAG(z) ((z).imag)
2175 #if defined(__cplusplus) && CYTHON_CCOMPLEX\
2176 && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
2177 #define __Pyx_SET_CREAL(z,x) ((z).real(x))
2178 #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
2180 #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
2181 #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
2186 #define __Pyx_c_eq_float(a, b) ((a)==(b))
2187 #define __Pyx_c_sum_float(a, b) ((a)+(b))
2188 #define __Pyx_c_diff_float(a, b) ((a)-(b))
2189 #define __Pyx_c_prod_float(a, b) ((a)*(b))
2190 #define __Pyx_c_quot_float(a, b) ((a)/(b))
2191 #define __Pyx_c_neg_float(a) (-(a))
2193 #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
2194 #define __Pyx_c_conj_float(z) (::std::conj(z))
2196 #define __Pyx_c_abs_float(z) (::std::abs(z))
2197 #define __Pyx_c_pow_float(a, b) (::std::pow(a, b))
2200 #define __Pyx_c_is_zero_float(z) ((z)==0)
2201 #define __Pyx_c_conj_float(z) (conjf(z))
2203 #define __Pyx_c_abs_float(z) (cabsf(z))
2204 #define __Pyx_c_pow_float(a, b) (cpowf(a, b))
2208 static CYTHON_INLINE
int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
2209 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
2210 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
2211 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
2212 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
2213 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
2214 static CYTHON_INLINE
int __Pyx_c_is_zero_float(__pyx_t_float_complex);
2215 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
2217 static CYTHON_INLINE
float __Pyx_c_abs_float(__pyx_t_float_complex);
2218 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
2224 #define __Pyx_c_eq_double(a, b) ((a)==(b))
2225 #define __Pyx_c_sum_double(a, b) ((a)+(b))
2226 #define __Pyx_c_diff_double(a, b) ((a)-(b))
2227 #define __Pyx_c_prod_double(a, b) ((a)*(b))
2228 #define __Pyx_c_quot_double(a, b) ((a)/(b))
2229 #define __Pyx_c_neg_double(a) (-(a))
2231 #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
2232 #define __Pyx_c_conj_double(z) (::std::conj(z))
2234 #define __Pyx_c_abs_double(z) (::std::abs(z))
2235 #define __Pyx_c_pow_double(a, b) (::std::pow(a, b))
2238 #define __Pyx_c_is_zero_double(z) ((z)==0)
2239 #define __Pyx_c_conj_double(z) (conj(z))
2241 #define __Pyx_c_abs_double(z) (cabs(z))
2242 #define __Pyx_c_pow_double(a, b) (cpow(a, b))
2246 static CYTHON_INLINE
int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
2247 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
2248 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
2249 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
2250 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
2251 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
2252 static CYTHON_INLINE
int __Pyx_c_is_zero_double(__pyx_t_double_complex);
2253 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
2255 static CYTHON_INLINE
double __Pyx_c_abs_double(__pyx_t_double_complex);
2256 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
2261 static __Pyx_memviewslice
2262 __pyx_memoryview_copy_new_contig(
const __Pyx_memviewslice *from_mvs,
2263 const char *mode,
int ndim,
2264 size_t sizeof_dtype,
int contig_flag,
2265 int dtype_is_object);
2268 static CYTHON_INLINE
int __Pyx_PyInt_As_int(PyObject *);
2271 static CYTHON_INLINE
long __Pyx_PyInt_As_long(PyObject *);
2274 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(
int value);
2277 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(
long value);
2280 static CYTHON_INLINE
char __Pyx_PyInt_As_char(PyObject *);
2283 static int __Pyx_check_binary_version(
void);
2286 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
2288 static PyObject *__pyx_array_get_memview(
struct __pyx_array_obj *__pyx_v_self);
2289 static char *__pyx_memoryview_get_item_pointer(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index);
2290 static PyObject *__pyx_memoryview_is_slice(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj);
2291 static PyObject *__pyx_memoryview_setitem_slice_assignment(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src);
2292 static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(
struct __pyx_memoryview_obj *__pyx_v_self,
struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value);
2293 static PyObject *__pyx_memoryview_setitem_indexed(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value);
2294 static PyObject *__pyx_memoryview_convert_item_to_object(
struct __pyx_memoryview_obj *__pyx_v_self,
char *__pyx_v_itemp);
2295 static PyObject *__pyx_memoryview_assign_item_from_object(
struct __pyx_memoryview_obj *__pyx_v_self,
char *__pyx_v_itemp, PyObject *__pyx_v_value);
2296 static PyObject *__pyx_memoryviewslice_convert_item_to_object(
struct __pyx_memoryviewslice_obj *__pyx_v_self,
char *__pyx_v_itemp);
2297 static PyObject *__pyx_memoryviewslice_assign_item_from_object(
struct __pyx_memoryviewslice_obj *__pyx_v_self,
char *__pyx_v_itemp, PyObject *__pyx_v_value);
2310 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
2323 static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
2324 static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
2325 static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
2326 static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
2327 static PyTypeObject *__pyx_ptype_5numpy_generic = 0;
2328 static PyTypeObject *__pyx_ptype_5numpy_number = 0;
2329 static PyTypeObject *__pyx_ptype_5numpy_integer = 0;
2330 static PyTypeObject *__pyx_ptype_5numpy_signedinteger = 0;
2331 static PyTypeObject *__pyx_ptype_5numpy_unsignedinteger = 0;
2332 static PyTypeObject *__pyx_ptype_5numpy_inexact = 0;
2333 static PyTypeObject *__pyx_ptype_5numpy_floating = 0;
2334 static PyTypeObject *__pyx_ptype_5numpy_complexfloating = 0;
2335 static PyTypeObject *__pyx_ptype_5numpy_flexible = 0;
2336 static PyTypeObject *__pyx_ptype_5numpy_character = 0;
2337 static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
2340 static PyTypeObject *__pyx_ptype_7proteus_15superluWrappers_cSparseMatrix = 0;
2347 static PyTypeObject *__pyx_ptype_10csmoothers_cASMFactor = 0;
2348 static PyTypeObject *__pyx_ptype_10csmoothers_cBASMFactor = 0;
2349 static PyTypeObject *__pyx_array_type = 0;
2350 static PyTypeObject *__pyx_MemviewEnum_type = 0;
2351 static PyTypeObject *__pyx_memoryview_type = 0;
2352 static PyTypeObject *__pyx_memoryviewslice_type = 0;
2353 static PyObject *
generic = 0;
2354 static PyObject *strided = 0;
2355 static PyObject *indirect = 0;
2356 static PyObject *contiguous = 0;
2357 static PyObject *indirect_contiguous = 0;
2358 static int __pyx_memoryview_thread_locks_used;
2359 static PyThread_type_lock __pyx_memoryview_thread_locks[8];
2360 static void __pyx_f_10csmoothers_smootherWrappersjacobi_NR_prepare(
struct __pyx_obj_7proteus_15superluWrappers_cSparseMatrix *,
double,
double, __pyx_t_10csmoothers_DDATA);
2361 static void __pyx_f_10csmoothers_smootherWrappersjacobi_NR_solve(
struct __pyx_obj_7proteus_15superluWrappers_cSparseMatrix *, __pyx_t_10csmoothers_DDATA, __pyx_t_10csmoothers_DDATA, __pyx_t_10csmoothers_IDATA, __pyx_t_10csmoothers_DDATA);
2362 static void __pyx_f_10csmoothers_smootherWrappersnl_jacobi_NR_solve(
struct __pyx_obj_7proteus_15superluWrappers_cSparseMatrix *, __pyx_t_10csmoothers_DDATA, __pyx_t_10csmoothers_IDATA,
double,
double, __pyx_t_10csmoothers_DDATA);
2363 static void __pyx_f_10csmoothers_smootherWrappersgauss_seidel_NR_prepare(
struct __pyx_obj_7proteus_15superluWrappers_cSparseMatrix *,
double,
double, __pyx_t_10csmoothers_DDATA);
2364 static void __pyx_f_10csmoothers_smootherWrappersgauss_seidel_NR_solve(
struct __pyx_obj_7proteus_15superluWrappers_cSparseMatrix *, __pyx_t_10csmoothers_DDATA, __pyx_t_10csmoothers_DDATA, __pyx_t_10csmoothers_IDATA, __pyx_t_10csmoothers_DDATA);
2365 static PyObject *__pyx_f_10csmoothers_smootherWrappers_nl_gauss_seidel_NR_solve(
struct __pyx_obj_7proteus_15superluWrappers_cSparseMatrix *, __pyx_t_10csmoothers_DDATA, __pyx_t_10csmoothers_IDATA,
double,
double, __pyx_t_10csmoothers_DDATA);
2366 static void __pyx_f_10csmoothers_smootherWrappers_asm_NR_prepare(
struct __pyx_obj_7proteus_15superluWrappers_cSparseMatrix *,
struct __pyx_obj_10csmoothers_cASMFactor *);
2367 static void __pyx_f_10csmoothers_smootherWrappers_asm_NR_solve(
struct __pyx_obj_7proteus_15superluWrappers_cSparseMatrix *,
double,
struct __pyx_obj_10csmoothers_cASMFactor *, __pyx_t_10csmoothers_IDATA, __pyx_t_10csmoothers_DDATA, __pyx_t_10csmoothers_DDATA);
2368 static void __pyx_f_10csmoothers_smootherWrappers_basm_NR_prepare(
struct __pyx_obj_7proteus_15superluWrappers_cSparseMatrix *,
struct __pyx_obj_10csmoothers_cBASMFactor *);
2369 static void __pyx_f_10csmoothers_smootherWrappers_basm_NR_solve(
struct __pyx_obj_7proteus_15superluWrappers_cSparseMatrix *,
double,
struct __pyx_obj_10csmoothers_cBASMFactor *, __pyx_t_10csmoothers_IDATA, __pyx_t_10csmoothers_DDATA, __pyx_t_10csmoothers_DDATA);
2370 static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t,
char *,
char *,
char *);
2371 static void *__pyx_align_pointer(
void *,
size_t);
2372 static PyObject *__pyx_memoryview_new(PyObject *,
int,
int, __Pyx_TypeInfo *);
2373 static CYTHON_INLINE
int __pyx_memoryview_check(PyObject *);
2374 static PyObject *_unellipsify(PyObject *,
int);
2375 static PyObject *assert_direct_dimensions(Py_ssize_t *,
int);
2376 static struct __pyx_memoryview_obj *__pyx_memview_slice(
struct __pyx_memoryview_obj *, PyObject *);
2377 static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t,
int,
int,
int *, Py_ssize_t, Py_ssize_t, Py_ssize_t,
int,
int,
int,
int);
2378 static char *__pyx_pybuffer_index(Py_buffer *,
char *, Py_ssize_t, Py_ssize_t);
2379 static int __pyx_memslice_transpose(__Pyx_memviewslice *);
2380 static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice,
int, PyObject *(*)(
char *),
int (*)(
char *, PyObject *),
int);
2381 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(
struct __pyx_memoryview_obj *, __Pyx_memviewslice *);
2382 static void __pyx_memoryview_slice_copy(
struct __pyx_memoryview_obj *, __Pyx_memviewslice *);
2383 static PyObject *__pyx_memoryview_copy_object(
struct __pyx_memoryview_obj *);
2384 static PyObject *__pyx_memoryview_copy_object_from_slice(
struct __pyx_memoryview_obj *, __Pyx_memviewslice *);
2385 static Py_ssize_t abs_py_ssize_t(Py_ssize_t);
2386 static char __pyx_get_best_slice_order(__Pyx_memviewslice *,
int);
2387 static void _copy_strided_to_strided(
char *, Py_ssize_t *,
char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *,
int,
size_t);
2388 static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *,
int,
size_t);
2389 static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *,
int);
2390 static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t,
int,
char);
2391 static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *,
char,
int);
2392 static int __pyx_memoryview_err_extents(
int, Py_ssize_t, Py_ssize_t);
2393 static int __pyx_memoryview_err_dim(PyObject *,
char *,
int);
2394 static int __pyx_memoryview_err(PyObject *,
char *);
2395 static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice,
int,
int,
int);
2396 static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *,
int,
int);
2397 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *,
int,
int,
int);
2398 static void __pyx_memoryview_refcount_objects_in_slice_with_gil(
char *, Py_ssize_t *, Py_ssize_t *,
int,
int);
2399 static void __pyx_memoryview_refcount_objects_in_slice(
char *, Py_ssize_t *, Py_ssize_t *,
int,
int);
2400 static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *,
int,
size_t,
void *,
int);
2401 static void __pyx_memoryview__slice_assign_scalar(
char *, Py_ssize_t *, Py_ssize_t *,
int,
size_t,
void *);
2402 static PyObject *__pyx_unpickle_Enum__set_state(
struct __pyx_MemviewEnum_obj *, PyObject *);
2403 static __Pyx_TypeInfo __Pyx_TypeInfo_double = {
"double", NULL,
sizeof(double), { 0 }, 0,
'R', 0, 0 };
2404 static __Pyx_TypeInfo __Pyx_TypeInfo_int = {
"int", NULL,
sizeof(int), { 0 }, 0, IS_UNSIGNED(
int) ?
'U' :
'I', IS_UNSIGNED(
int), 0 };
2405 #define __Pyx_MODULE_NAME "csmoothers"
2406 extern int __pyx_module_is_main_csmoothers;
2407 int __pyx_module_is_main_csmoothers = 0;
2410 static PyObject *__pyx_builtin_object;
2411 static PyObject *__pyx_builtin_TypeError;
2412 static PyObject *__pyx_builtin_ImportError;
2413 static PyObject *__pyx_builtin_ValueError;
2414 static PyObject *__pyx_builtin_MemoryError;
2415 static PyObject *__pyx_builtin_enumerate;
2416 static PyObject *__pyx_builtin_range;
2417 static PyObject *__pyx_builtin_Ellipsis;
2418 static PyObject *__pyx_builtin_id;
2419 static PyObject *__pyx_builtin_IndexError;
2420 static const char __pyx_k_A[] =
"A";
2421 static const char __pyx_k_L[] =
"L";
2422 static const char __pyx_k_M[] =
"M";
2423 static const char __pyx_k_O[] =
"O";
2424 static const char __pyx_k_R[] =
"R";
2425 static const char __pyx_k_c[] =
"c";
2426 static const char __pyx_k_w[] =
"w";
2427 static const char __pyx_k_bs[] =
"bs";
2428 static const char __pyx_k_dX[] =
"dX";
2429 static const char __pyx_k_id[] =
"id";
2430 static const char __pyx_k_nc[] =
"nc";
2431 static const char __pyx_k_np[] =
"np";
2432 static const char __pyx_k_nr[] =
"nr";
2433 static const char __pyx_k_doc[] =
"__doc__";
2434 static const char __pyx_k_new[] =
"__new__";
2435 static const char __pyx_k_obj[] =
"obj";
2436 static const char __pyx_k_tol[] =
"tol";
2437 static const char __pyx_k_base[] =
"base";
2438 static const char __pyx_k_dict[] =
"__dict__";
2439 static const char __pyx_k_init[] =
"__init__";
2440 static const char __pyx_k_main[] =
"__main__";
2441 static const char __pyx_k_mode[] =
"mode";
2442 static const char __pyx_k_name[] =
"name";
2443 static const char __pyx_k_ndim[] =
"ndim";
2444 static const char __pyx_k_pack[] =
"pack";
2445 static const char __pyx_k_self[] =
"self";
2446 static const char __pyx_k_size[] =
"size";
2447 static const char __pyx_k_step[] =
"step";
2448 static const char __pyx_k_stop[] =
"stop";
2449 static const char __pyx_k_test[] =
"__test__";
2450 static const char __pyx_k_ASCII[] =
"ASCII";
2451 static const char __pyx_k_class[] =
"__class__";
2452 static const char __pyx_k_error[] =
"error";
2453 static const char __pyx_k_flags[] =
"flags";
2454 static const char __pyx_k_numpy[] =
"numpy";
2455 static const char __pyx_k_range[] =
"range";
2456 static const char __pyx_k_shape[] =
"shape";
2457 static const char __pyx_k_start[] =
"start";
2458 static const char __pyx_k_encode[] =
"encode";
2459 static const char __pyx_k_format[] =
"format";
2460 static const char __pyx_k_import[] =
"__import__";
2461 static const char __pyx_k_module[] =
"__module__";
2462 static const char __pyx_k_name_2[] =
"__name__";
2463 static const char __pyx_k_object[] =
"object";
2464 static const char __pyx_k_pickle[] =
"pickle";
2465 static const char __pyx_k_reduce[] =
"__reduce__";
2466 static const char __pyx_k_struct[] =
"struct";
2467 static const char __pyx_k_unpack[] =
"unpack";
2468 static const char __pyx_k_update[] =
"update";
2469 static const char __pyx_k_fortran[] =
"fortran";
2470 static const char __pyx_k_memview[] =
"memview";
2471 static const char __pyx_k_prepare[] =
"__prepare__";
2472 static const char __pyx_k_Ellipsis[] =
"Ellipsis";
2473 static const char __pyx_k_getstate[] =
"__getstate__";
2474 static const char __pyx_k_itemsize[] =
"itemsize";
2475 static const char __pyx_k_pyx_type[] =
"__pyx_type";
2476 static const char __pyx_k_qualname[] =
"__qualname__";
2477 static const char __pyx_k_setstate[] =
"__setstate__";
2478 static const char __pyx_k_ASMFactor[] =
"ASMFactor";
2479 static const char __pyx_k_TypeError[] =
"TypeError";
2480 static const char __pyx_k_asmFactor[] =
"asmFactor";
2481 static const char __pyx_k_enumerate[] =
"enumerate";
2482 static const char __pyx_k_metaclass[] =
"__metaclass__";
2483 static const char __pyx_k_pyx_state[] =
"__pyx_state";
2484 static const char __pyx_k_reduce_ex[] =
"__reduce_ex__";
2485 static const char __pyx_k_BASMFactor[] =
"BASMFactor";
2486 static const char __pyx_k_IndexError[] =
"IndexError";
2487 static const char __pyx_k_ValueError[] =
"ValueError";
2488 static const char __pyx_k_basmFactor[] =
"basmFactor";
2489 static const char __pyx_k_cASMFactor[] =
"_cASMFactor";
2490 static const char __pyx_k_csmoothers[] =
"csmoothers";
2491 static const char __pyx_k_node_order[] =
"node_order";
2492 static const char __pyx_k_pyx_result[] =
"__pyx_result";
2493 static const char __pyx_k_pyx_vtable[] =
"__pyx_vtable__";
2494 static const char __pyx_k_ImportError[] =
"ImportError";
2495 static const char __pyx_k_MemoryError[] =
"MemoryError";
2496 static const char __pyx_k_PickleError[] =
"PickleError";
2497 static const char __pyx_k_cBASMFactor[] =
"_cBASMFactor";
2498 static const char __pyx_k_asm_NR_solve[] =
"asm_NR_solve";
2499 static const char __pyx_k_cASMFactor_2[] =
"cASMFactor";
2500 static const char __pyx_k_pyx_checksum[] =
"__pyx_checksum";
2501 static const char __pyx_k_stringsource[] =
"stringsource";
2502 static const char __pyx_k_basm_NR_solve[] =
"basm_NR_solve";
2503 static const char __pyx_k_cBASMFactor_2[] =
"cBASMFactor";
2504 static const char __pyx_k_cSparseMatrix[] =
"_cSparseMatrix";
2505 static const char __pyx_k_pyx_getbuffer[] =
"__pyx_getbuffer";
2506 static const char __pyx_k_reduce_cython[] =
"__reduce_cython__";
2507 static const char __pyx_k_asm_NR_prepare[] =
"asm_NR_prepare";
2508 static const char __pyx_k_View_MemoryView[] =
"View.MemoryView";
2509 static const char __pyx_k_allocate_buffer[] =
"allocate_buffer";
2510 static const char __pyx_k_basm_NR_prepare[] =
"basm_NR_prepare";
2511 static const char __pyx_k_dtype_is_object[] =
"dtype_is_object";
2512 static const char __pyx_k_jacobi_NR_solve[] =
"jacobi_NR_solve";
2513 static const char __pyx_k_pyx_PickleError[] =
"__pyx_PickleError";
2514 static const char __pyx_k_setstate_cython[] =
"__setstate_cython__";
2515 static const char __pyx_k_ASMFactor___init[] =
"ASMFactor.__init__";
2516 static const char __pyx_k_BASMFactor___init[] =
"BASMFactor.__init__";
2517 static const char __pyx_k_jacobi_NR_prepare[] =
"jacobi_NR_prepare";
2518 static const char __pyx_k_pyx_unpickle_Enum[] =
"__pyx_unpickle_Enum";
2519 static const char __pyx_k_cline_in_traceback[] =
"cline_in_traceback";
2520 static const char __pyx_k_nl_jacobi_NR_solve[] =
"nl_jacobi_NR_solve";
2521 static const char __pyx_k_strided_and_direct[] =
"<strided and direct>";
2522 static const char __pyx_k_strided_and_indirect[] =
"<strided and indirect>";
2523 static const char __pyx_k_contiguous_and_direct[] =
"<contiguous and direct>";
2524 static const char __pyx_k_gauss_seidel_NR_solve[] =
"gauss_seidel_NR_solve";
2525 static const char __pyx_k_MemoryView_of_r_object[] =
"<MemoryView of %r object>";
2526 static const char __pyx_k_gauss_seidel_NR_preare[] =
"gauss_seidel_NR_preare";
2527 static const char __pyx_k_proteus_csmoothers_pyx[] =
"proteus/csmoothers.pyx";
2528 static const char __pyx_k_MemoryView_of_r_at_0x_x[] =
"<MemoryView of %r at 0x%x>";
2529 static const char __pyx_k_contiguous_and_indirect[] =
"<contiguous and indirect>";
2530 static const char __pyx_k_Cannot_index_with_type_s[] =
"Cannot index with type '%s'";
2531 static const char __pyx_k_nl_gauss_seidel_NR_solve[] =
"nl_gauss_seidel_NR_solve";
2532 static const char __pyx_k_Invalid_shape_in_axis_d_d[] =
"Invalid shape in axis %d: %d.";
2533 static const char __pyx_k_itemsize_0_for_cython_array[] =
"itemsize <= 0 for cython.array";
2534 static const char __pyx_k_unable_to_allocate_array_data[] =
"unable to allocate array data.";
2535 static const char __pyx_k_strided_and_direct_or_indirect[] =
"<strided and direct or indirect>";
2536 static const char __pyx_k_numpy_core_multiarray_failed_to[] =
"numpy.core.multiarray failed to import";
2537 static const char __pyx_k_Buffer_view_does_not_expose_stri[] =
"Buffer view does not expose strides";
2538 static const char __pyx_k_Can_only_create_a_buffer_that_is[] =
"Can only create a buffer that is contiguous in memory.";
2539 static const char __pyx_k_Cannot_assign_to_read_only_memor[] =
"Cannot assign to read-only memoryview";
2540 static const char __pyx_k_Cannot_create_writable_memory_vi[] =
"Cannot create writable memory view from read-only memoryview";
2541 static const char __pyx_k_Empty_shape_tuple_for_cython_arr[] =
"Empty shape tuple for cython.array";
2542 static const char __pyx_k_Incompatible_checksums_s_vs_0xb0[] =
"Incompatible checksums (%s vs 0xb068931 = (name))";
2543 static const char __pyx_k_Indirect_dimensions_not_supporte[] =
"Indirect dimensions not supported";
2544 static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] =
"Invalid mode, expected 'c' or 'fortran', got %s";
2545 static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] =
"Out of bounds on buffer access (axis %d)";
2546 static const char __pyx_k_Unable_to_convert_item_to_object[] =
"Unable to convert item to object";
2547 static const char __pyx_k_got_differing_extents_in_dimensi[] =
"got differing extents in dimension %d (got %d and %d)";
2548 static const char __pyx_k_no_default___reduce___due_to_non[] =
"no default __reduce__ due to non-trivial __cinit__";
2549 static const char __pyx_k_numpy_core_umath_failed_to_impor[] =
"numpy.core.umath failed to import";
2550 static const char __pyx_k_unable_to_allocate_shape_and_str[] =
"unable to allocate shape and strides.";
2551 static PyObject *__pyx_n_s_A;
2552 static PyObject *__pyx_n_s_ASCII;
2553 static PyObject *__pyx_n_s_ASMFactor;
2554 static PyObject *__pyx_n_s_ASMFactor___init;
2555 static PyObject *__pyx_n_s_BASMFactor;
2556 static PyObject *__pyx_n_s_BASMFactor___init;
2557 static PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri;
2558 static PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is;
2559 static PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor;
2560 static PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi;
2561 static PyObject *__pyx_kp_s_Cannot_index_with_type_s;
2562 static PyObject *__pyx_n_s_Ellipsis;
2563 static PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr;
2564 static PyObject *__pyx_n_s_ImportError;
2565 static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xb0;
2566 static PyObject *__pyx_n_s_IndexError;
2567 static PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte;
2568 static PyObject *__pyx_kp_s_Invalid_mode_expected_c_or_fortr;
2569 static PyObject *__pyx_kp_s_Invalid_shape_in_axis_d_d;
2570 static PyObject *__pyx_n_s_L;
2571 static PyObject *__pyx_n_s_M;
2572 static PyObject *__pyx_n_s_MemoryError;
2573 static PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x;
2574 static PyObject *__pyx_kp_s_MemoryView_of_r_object;
2575 static PyObject *__pyx_n_b_O;
2576 static PyObject *__pyx_kp_s_Out_of_bounds_on_buffer_access_a;
2577 static PyObject *__pyx_n_s_PickleError;
2578 static PyObject *__pyx_n_s_R;
2579 static PyObject *__pyx_n_s_TypeError;
2580 static PyObject *__pyx_kp_s_Unable_to_convert_item_to_object;
2581 static PyObject *__pyx_n_s_ValueError;
2582 static PyObject *__pyx_n_s_View_MemoryView;
2583 static PyObject *__pyx_n_s_allocate_buffer;
2584 static PyObject *__pyx_n_s_asmFactor;
2585 static PyObject *__pyx_n_s_asm_NR_prepare;
2586 static PyObject *__pyx_n_s_asm_NR_solve;
2587 static PyObject *__pyx_n_s_base;
2588 static PyObject *__pyx_n_s_basmFactor;
2589 static PyObject *__pyx_n_s_basm_NR_prepare;
2590 static PyObject *__pyx_n_s_basm_NR_solve;
2591 static PyObject *__pyx_n_s_bs;
2592 static PyObject *__pyx_n_s_c;
2593 static PyObject *__pyx_n_u_c;
2594 static PyObject *__pyx_n_s_cASMFactor;
2595 static PyObject *__pyx_n_s_cASMFactor_2;
2596 static PyObject *__pyx_n_s_cBASMFactor;
2597 static PyObject *__pyx_n_s_cBASMFactor_2;
2598 static PyObject *__pyx_n_s_cSparseMatrix;
2599 static PyObject *__pyx_n_s_class;
2600 static PyObject *__pyx_n_s_cline_in_traceback;
2601 static PyObject *__pyx_kp_s_contiguous_and_direct;
2602 static PyObject *__pyx_kp_s_contiguous_and_indirect;
2603 static PyObject *__pyx_n_s_csmoothers;
2604 static PyObject *__pyx_n_s_dX;
2605 static PyObject *__pyx_n_s_dict;
2606 static PyObject *__pyx_n_s_doc;
2607 static PyObject *__pyx_n_s_dtype_is_object;
2608 static PyObject *__pyx_n_s_encode;
2609 static PyObject *__pyx_n_s_enumerate;
2610 static PyObject *__pyx_n_s_error;
2611 static PyObject *__pyx_n_s_flags;
2612 static PyObject *__pyx_n_s_format;
2613 static PyObject *__pyx_n_s_fortran;
2614 static PyObject *__pyx_n_u_fortran;
2615 static PyObject *__pyx_n_s_gauss_seidel_NR_preare;
2616 static PyObject *__pyx_n_s_gauss_seidel_NR_solve;
2617 static PyObject *__pyx_n_s_getstate;
2618 static PyObject *__pyx_kp_s_got_differing_extents_in_dimensi;
2619 static PyObject *__pyx_n_s_id;
2620 static PyObject *__pyx_n_s_import;
2621 static PyObject *__pyx_n_s_init;
2622 static PyObject *__pyx_n_s_itemsize;
2623 static PyObject *__pyx_kp_s_itemsize_0_for_cython_array;
2624 static PyObject *__pyx_n_s_jacobi_NR_prepare;
2625 static PyObject *__pyx_n_s_jacobi_NR_solve;
2626 static PyObject *__pyx_n_s_main;
2627 static PyObject *__pyx_n_s_memview;
2628 static PyObject *__pyx_n_s_metaclass;
2629 static PyObject *__pyx_n_s_mode;
2630 static PyObject *__pyx_n_s_module;
2631 static PyObject *__pyx_n_s_name;
2632 static PyObject *__pyx_n_s_name_2;
2633 static PyObject *__pyx_n_s_nc;
2634 static PyObject *__pyx_n_s_ndim;
2635 static PyObject *__pyx_n_s_new;
2636 static PyObject *__pyx_n_s_nl_gauss_seidel_NR_solve;
2637 static PyObject *__pyx_n_s_nl_jacobi_NR_solve;
2638 static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
2639 static PyObject *__pyx_n_s_node_order;
2640 static PyObject *__pyx_n_s_np;
2641 static PyObject *__pyx_n_s_nr;
2642 static PyObject *__pyx_n_s_numpy;
2643 static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to;
2644 static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor;
2645 static PyObject *__pyx_n_s_obj;
2646 static PyObject *__pyx_n_s_object;
2647 static PyObject *__pyx_n_s_pack;
2648 static PyObject *__pyx_n_s_pickle;
2649 static PyObject *__pyx_n_s_prepare;
2650 static PyObject *__pyx_kp_s_proteus_csmoothers_pyx;
2651 static PyObject *__pyx_n_s_pyx_PickleError;
2652 static PyObject *__pyx_n_s_pyx_checksum;
2653 static PyObject *__pyx_n_s_pyx_getbuffer;
2654 static PyObject *__pyx_n_s_pyx_result;
2655 static PyObject *__pyx_n_s_pyx_state;
2656 static PyObject *__pyx_n_s_pyx_type;
2657 static PyObject *__pyx_n_s_pyx_unpickle_Enum;
2658 static PyObject *__pyx_n_s_pyx_vtable;
2659 static PyObject *__pyx_n_s_qualname;
2660 static PyObject *__pyx_n_s_range;
2661 static PyObject *__pyx_n_s_reduce;
2662 static PyObject *__pyx_n_s_reduce_cython;
2663 static PyObject *__pyx_n_s_reduce_ex;
2664 static PyObject *__pyx_n_s_self;
2665 static PyObject *__pyx_n_s_setstate;
2666 static PyObject *__pyx_n_s_setstate_cython;
2667 static PyObject *__pyx_n_s_shape;
2668 static PyObject *__pyx_n_s_size;
2669 static PyObject *__pyx_n_s_start;
2670 static PyObject *__pyx_n_s_step;
2671 static PyObject *__pyx_n_s_stop;
2672 static PyObject *__pyx_kp_s_strided_and_direct;
2673 static PyObject *__pyx_kp_s_strided_and_direct_or_indirect;
2674 static PyObject *__pyx_kp_s_strided_and_indirect;
2675 static PyObject *__pyx_kp_s_stringsource;
2676 static PyObject *__pyx_n_s_struct;
2677 static PyObject *__pyx_n_s_test;
2678 static PyObject *__pyx_n_s_tol;
2679 static PyObject *__pyx_kp_s_unable_to_allocate_array_data;
2680 static PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str;
2681 static PyObject *__pyx_n_s_unpack;
2682 static PyObject *__pyx_n_s_update;
2683 static PyObject *__pyx_n_s_w;
2684 static PyObject *__pyx_pf_10csmoothers_9ASMFactor___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_L);
2685 static int __pyx_pf_10csmoothers_10cASMFactor___cinit__(
struct __pyx_obj_10csmoothers_cASMFactor *__pyx_v_self,
struct __pyx_obj_7proteus_15superluWrappers_cSparseMatrix *__pyx_v_L);
2686 static void __pyx_pf_10csmoothers_10cASMFactor_2__dealloc__(
struct __pyx_obj_10csmoothers_cASMFactor *__pyx_v_self);
2687 static PyObject *__pyx_pf_10csmoothers_10cASMFactor_4__reduce_cython__(CYTHON_UNUSED
struct __pyx_obj_10csmoothers_cASMFactor *__pyx_v_self);
2688 static PyObject *__pyx_pf_10csmoothers_10cASMFactor_6__setstate_cython__(CYTHON_UNUSED
struct __pyx_obj_10csmoothers_cASMFactor *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state);
2689 static PyObject *__pyx_pf_10csmoothers_10BASMFactor___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_L, PyObject *__pyx_v_bs);
2690 static int __pyx_pf_10csmoothers_11cBASMFactor___cinit__(
struct __pyx_obj_10csmoothers_cBASMFactor *__pyx_v_self,
struct __pyx_obj_7proteus_15superluWrappers_cSparseMatrix *__pyx_v_L,
int __pyx_v_bs);
2691 static void __pyx_pf_10csmoothers_11cBASMFactor_2__dealloc__(
struct __pyx_obj_10csmoothers_cBASMFactor *__pyx_v_self);
2692 static PyObject *__pyx_pf_10csmoothers_11cBASMFactor_4__reduce_cython__(CYTHON_UNUSED
struct __pyx_obj_10csmoothers_cBASMFactor *__pyx_v_self);
2693 static PyObject *__pyx_pf_10csmoothers_11cBASMFactor_6__setstate_cython__(CYTHON_UNUSED
struct __pyx_obj_10csmoothers_cBASMFactor *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state);
2694 static PyObject *__pyx_pf_10csmoothers_jacobi_NR_prepare(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_w, PyObject *__pyx_v_tol, PyObject *__pyx_v_M);
2695 static PyObject *__pyx_pf_10csmoothers_2jacobi_NR_solve(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_M, PyObject *__pyx_v_R, PyObject *__pyx_v_node_order, PyObject *__pyx_v_dX);
2696 static PyObject *__pyx_pf_10csmoothers_4nl_jacobi_NR_solve(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_R, PyObject *__pyx_v_node_order, PyObject *__pyx_v_w, PyObject *__pyx_v_tol, PyObject *__pyx_v_dX);
2697 static PyObject *__pyx_pf_10csmoothers_6gauss_seidel_NR_preare(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_w, PyObject *__pyx_v_tol, PyObject *__pyx_v_M);
2698 static PyObject *__pyx_pf_10csmoothers_8gauss_seidel_NR_solve(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_M, PyObject *__pyx_v_R, PyObject *__pyx_v_node_order, PyObject *__pyx_v_dX);
2699 static PyObject *__pyx_pf_10csmoothers_10nl_gauss_seidel_NR_solve(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_R, PyObject *__pyx_v_node_order, PyObject *__pyx_v_w, PyObject *__pyx_v_tol, PyObject *__pyx_v_dX);
2700 static PyObject *__pyx_pf_10csmoothers_12asm_NR_prepare(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_asmFactor);
2701 static PyObject *__pyx_pf_10csmoothers_14asm_NR_solve(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_w, PyObject *__pyx_v_asmFactor, PyObject *__pyx_v_node_order, PyObject *__pyx_v_R, PyObject *__pyx_v_dX);
2702 static PyObject *__pyx_pf_10csmoothers_16basm_NR_prepare(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_basmFactor);
2703 static PyObject *__pyx_pf_10csmoothers_18basm_NR_solve(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_w, PyObject *__pyx_v_basmFactor, PyObject *__pyx_v_node_order, PyObject *__pyx_v_R, PyObject *__pyx_v_dX);
2704 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode,
int __pyx_v_allocate_buffer);
2705 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(
struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
2706 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(
struct __pyx_array_obj *__pyx_v_self);
2707 static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(
struct __pyx_array_obj *__pyx_v_self);
2708 static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(
struct __pyx_array_obj *__pyx_v_self);
2709 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr);
2710 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item);
2711 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value);
2712 static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED
struct __pyx_array_obj *__pyx_v_self);
2713 static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state);
2714 static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(
struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name);
2715 static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(
struct __pyx_MemviewEnum_obj *__pyx_v_self);
2716 static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(
struct __pyx_MemviewEnum_obj *__pyx_v_self);
2717 static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(
struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state);
2718 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj,
int __pyx_v_flags,
int __pyx_v_dtype_is_object);
2719 static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(
struct __pyx_memoryview_obj *__pyx_v_self);
2720 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index);
2721 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value);
2722 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(
struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
2723 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2724 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2725 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2726 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2727 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2728 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2729 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2730 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2731 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
2732 static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(
struct __pyx_memoryview_obj *__pyx_v_self);
2733 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(
struct __pyx_memoryview_obj *__pyx_v_self);
2734 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(
struct __pyx_memoryview_obj *__pyx_v_self);
2735 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(
struct __pyx_memoryview_obj *__pyx_v_self);
2736 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(
struct __pyx_memoryview_obj *__pyx_v_self);
2737 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(
struct __pyx_memoryview_obj *__pyx_v_self);
2738 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(
struct __pyx_memoryview_obj *__pyx_v_self);
2739 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED
struct __pyx_memoryview_obj *__pyx_v_self);
2740 static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state);
2741 static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(
struct __pyx_memoryviewslice_obj *__pyx_v_self);
2742 static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(
struct __pyx_memoryviewslice_obj *__pyx_v_self);
2743 static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED
struct __pyx_memoryviewslice_obj *__pyx_v_self);
2744 static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state);
2745 static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type,
long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state);
2746 static PyObject *__pyx_tp_new_10csmoothers_cASMFactor(PyTypeObject *t, PyObject *a, PyObject *k);
2747 static PyObject *__pyx_tp_new_10csmoothers_cBASMFactor(PyTypeObject *t, PyObject *a, PyObject *k);
2748 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k);
2749 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k);
2750 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k);
2751 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k);
2752 static PyObject *__pyx_int_0;
2753 static PyObject *__pyx_int_1;
2754 static PyObject *__pyx_int_184977713;
2755 static PyObject *__pyx_int_neg_1;
2756 static PyObject *__pyx_tuple_;
2757 static PyObject *__pyx_tuple__2;
2758 static PyObject *__pyx_tuple__3;
2759 static PyObject *__pyx_tuple__4;
2760 static PyObject *__pyx_tuple__5;
2761 static PyObject *__pyx_tuple__6;
2762 static PyObject *__pyx_tuple__7;
2763 static PyObject *__pyx_tuple__8;
2764 static PyObject *__pyx_tuple__9;
2765 static PyObject *__pyx_slice__21;
2766 static PyObject *__pyx_tuple__10;
2767 static PyObject *__pyx_tuple__11;
2768 static PyObject *__pyx_tuple__12;
2769 static PyObject *__pyx_tuple__13;
2770 static PyObject *__pyx_tuple__14;
2771 static PyObject *__pyx_tuple__15;
2772 static PyObject *__pyx_tuple__16;
2773 static PyObject *__pyx_tuple__17;
2774 static PyObject *__pyx_tuple__18;
2775 static PyObject *__pyx_tuple__19;
2776 static PyObject *__pyx_tuple__20;
2777 static PyObject *__pyx_tuple__22;
2778 static PyObject *__pyx_tuple__23;
2779 static PyObject *__pyx_tuple__24;
2780 static PyObject *__pyx_tuple__25;
2781 static PyObject *__pyx_tuple__26;
2782 static PyObject *__pyx_tuple__28;
2783 static PyObject *__pyx_tuple__29;
2784 static PyObject *__pyx_tuple__31;
2785 static PyObject *__pyx_tuple__33;
2786 static PyObject *__pyx_tuple__35;
2787 static PyObject *__pyx_tuple__37;
2788 static PyObject *__pyx_tuple__39;
2789 static PyObject *__pyx_tuple__41;
2790 static PyObject *__pyx_tuple__43;
2791 static PyObject *__pyx_tuple__45;
2792 static PyObject *__pyx_tuple__47;
2793 static PyObject *__pyx_tuple__49;
2794 static PyObject *__pyx_tuple__51;
2795 static PyObject *__pyx_tuple__52;
2796 static PyObject *__pyx_tuple__53;
2797 static PyObject *__pyx_tuple__54;
2798 static PyObject *__pyx_tuple__55;
2799 static PyObject *__pyx_tuple__56;
2800 static PyObject *__pyx_codeobj__27;
2801 static PyObject *__pyx_codeobj__30;
2802 static PyObject *__pyx_codeobj__32;
2803 static PyObject *__pyx_codeobj__34;
2804 static PyObject *__pyx_codeobj__36;
2805 static PyObject *__pyx_codeobj__38;
2806 static PyObject *__pyx_codeobj__40;
2807 static PyObject *__pyx_codeobj__42;
2808 static PyObject *__pyx_codeobj__44;
2809 static PyObject *__pyx_codeobj__46;
2810 static PyObject *__pyx_codeobj__48;
2811 static PyObject *__pyx_codeobj__50;
2812 static PyObject *__pyx_codeobj__57;
2824 static PyObject *__pyx_pw_10csmoothers_9ASMFactor_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
2825 static PyMethodDef __pyx_mdef_10csmoothers_9ASMFactor_1__init__ = {
"__init__", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_10csmoothers_9ASMFactor_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
2826 static PyObject *__pyx_pw_10csmoothers_9ASMFactor_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2827 PyObject *__pyx_v_self = 0;
2828 PyObject *__pyx_v_L = 0;
2829 int __pyx_lineno = 0;
2830 const char *__pyx_filename = NULL;
2831 int __pyx_clineno = 0;
2832 PyObject *__pyx_r = 0;
2833 __Pyx_RefNannyDeclarations
2834 __Pyx_RefNannySetupContext(
"__init__ (wrapper)", 0);
2836 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_L,0};
2837 PyObject* values[2] = {0,0};
2838 if (unlikely(__pyx_kwds)) {
2840 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2842 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2844 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2847 default:
goto __pyx_L5_argtuple_error;
2849 kw_args = PyDict_Size(__pyx_kwds);
2852 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
2853 else goto __pyx_L5_argtuple_error;
2856 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_L)) != 0)) kw_args--;
2858 __Pyx_RaiseArgtupleInvalid(
"__init__", 1, 2, 2, 1); __PYX_ERR(0, 7, __pyx_L3_error)
2861 if (unlikely(kw_args > 0)) {
2862 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__init__") < 0)) __PYX_ERR(0, 7, __pyx_L3_error)
2864 }
else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
2865 goto __pyx_L5_argtuple_error;
2867 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2868 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2870 __pyx_v_self = values[0];
2871 __pyx_v_L = values[1];
2873 goto __pyx_L4_argument_unpacking_done;
2874 __pyx_L5_argtuple_error:;
2875 __Pyx_RaiseArgtupleInvalid(
"__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 7, __pyx_L3_error)
2877 __Pyx_AddTraceback(
"csmoothers.ASMFactor.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2878 __Pyx_RefNannyFinishContext();
2880 __pyx_L4_argument_unpacking_done:;
2881 __pyx_r = __pyx_pf_10csmoothers_9ASMFactor___init__(__pyx_self, __pyx_v_self, __pyx_v_L);
2884 __Pyx_RefNannyFinishContext();
2888 static PyObject *__pyx_pf_10csmoothers_9ASMFactor___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_L) {
2889 PyObject *__pyx_r = NULL;
2890 __Pyx_RefNannyDeclarations
2891 PyObject *__pyx_t_1 = NULL;
2892 PyObject *__pyx_t_2 = NULL;
2893 int __pyx_lineno = 0;
2894 const char *__pyx_filename = NULL;
2895 int __pyx_clineno = 0;
2896 __Pyx_RefNannySetupContext(
"__init__", 0);
2905 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_L, __pyx_v_L) < 0) __PYX_ERR(0, 8, __pyx_L1_error)
2914 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_L);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error)
2915 __Pyx_GOTREF(__pyx_t_1);
2916 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_cSparseMatrix);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error)
2917 __Pyx_GOTREF(__pyx_t_2);
2918 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2919 __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_10csmoothers_cASMFactor), __pyx_t_2);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error)
2920 __Pyx_GOTREF(__pyx_t_1);
2921 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2922 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cASMFactor, __pyx_t_1) < 0) __PYX_ERR(0, 9, __pyx_L1_error)
2923 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2934 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2937 __Pyx_XDECREF(__pyx_t_1);
2938 __Pyx_XDECREF(__pyx_t_2);
2939 __Pyx_AddTraceback(
"csmoothers.ASMFactor.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2942 __Pyx_XGIVEREF(__pyx_r);
2943 __Pyx_RefNannyFinishContext();
2956 static int __pyx_pw_10csmoothers_10cASMFactor_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
2957 static int __pyx_pw_10csmoothers_10cASMFactor_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2958 struct __pyx_obj_7proteus_15superluWrappers_cSparseMatrix *__pyx_v_L = 0;
2959 int __pyx_lineno = 0;
2960 const char *__pyx_filename = NULL;
2961 int __pyx_clineno = 0;
2963 __Pyx_RefNannyDeclarations
2964 __Pyx_RefNannySetupContext(
"__cinit__ (wrapper)", 0);
2966 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_L,0};
2967 PyObject* values[1] = {0};
2968 if (unlikely(__pyx_kwds)) {
2970 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2972 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2975 default:
goto __pyx_L5_argtuple_error;
2977 kw_args = PyDict_Size(__pyx_kwds);
2980 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_L)) != 0)) kw_args--;
2981 else goto __pyx_L5_argtuple_error;
2983 if (unlikely(kw_args > 0)) {
2984 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__cinit__") < 0)) __PYX_ERR(0, 13, __pyx_L3_error)
2986 }
else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
2987 goto __pyx_L5_argtuple_error;
2989 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2991 __pyx_v_L = ((
struct __pyx_obj_7proteus_15superluWrappers_cSparseMatrix *)values[0]);
2993 goto __pyx_L4_argument_unpacking_done;
2994 __pyx_L5_argtuple_error:;
2995 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 13, __pyx_L3_error)
2997 __Pyx_AddTraceback(
"csmoothers.cASMFactor.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2998 __Pyx_RefNannyFinishContext();
3000 __pyx_L4_argument_unpacking_done:;
3001 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_L), __pyx_ptype_7proteus_15superluWrappers_cSparseMatrix, 1,
"L", 0))) __PYX_ERR(0, 14, __pyx_L1_error)
3002 __pyx_r = __pyx_pf_10csmoothers_10cASMFactor___cinit__(((
struct __pyx_obj_10csmoothers_cASMFactor *)__pyx_v_self), __pyx_v_L);
3009 __Pyx_RefNannyFinishContext();
3013 static int __pyx_pf_10csmoothers_10cASMFactor___cinit__(
struct __pyx_obj_10csmoothers_cASMFactor *__pyx_v_self,
struct __pyx_obj_7proteus_15superluWrappers_cSparseMatrix *__pyx_v_L) {
3015 __pyx_t_10csmoothers_SuperMatrix __pyx_v_AS;
3017 __Pyx_RefNannyDeclarations
3018 PyObject *__pyx_t_1 = NULL;
3020 int __pyx_lineno = 0;
3021 const char *__pyx_filename = NULL;
3022 int __pyx_clineno = 0;
3023 __Pyx_RefNannySetupContext(
"__cinit__", 0);
3041 __pyx_v_AS.Stype = SLU_NR;
3050 __pyx_v_AS.Dtype = SLU_D;
3059 __pyx_v_AS.Mtype = SLU_GE;
3068 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_L), __pyx_n_s_nr);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error)
3069 __Pyx_GOTREF(__pyx_t_1);
3070 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 20, __pyx_L1_error)
3071 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3072 __pyx_v_AS.nrow = __pyx_t_2;
3081 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_L), __pyx_n_s_nc);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 21, __pyx_L1_error)
3082 __Pyx_GOTREF(__pyx_t_1);
3083 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 21, __pyx_L1_error)
3084 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3085 __pyx_v_AS.ncol = __pyx_t_2;
3094 __pyx_v_AS.Store = (&__pyx_v_L->A);
3103 __pyx_v_rval =
asm_NR_init((&__pyx_v_AS), (&__pyx_v_self->subdomain_dim), (&__pyx_v_self->l2g_L), (&__pyx_v_self->subdomain_L), (&__pyx_v_self->subdomain_R), (&__pyx_v_self->subdomain_dX), (&__pyx_v_self->subdomain_pivots));
3112 #ifndef CYTHON_WITHOUT_ASSERTIONS
3113 if (unlikely(!Py_OptimizeFlag)) {
3114 if (unlikely(!((__pyx_v_rval == 0) != 0))) {
3115 PyErr_SetNone(PyExc_AssertionError);
3116 __PYX_ERR(0, 30, __pyx_L1_error)
3133 __Pyx_XDECREF(__pyx_t_1);
3134 __Pyx_AddTraceback(
"csmoothers.cASMFactor.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3137 __Pyx_RefNannyFinishContext();
3150 static void __pyx_pw_10csmoothers_10cASMFactor_3__dealloc__(PyObject *__pyx_v_self);
3151 static void __pyx_pw_10csmoothers_10cASMFactor_3__dealloc__(PyObject *__pyx_v_self) {
3152 __Pyx_RefNannyDeclarations
3153 __Pyx_RefNannySetupContext(
"__dealloc__ (wrapper)", 0);
3154 __pyx_pf_10csmoothers_10cASMFactor_2__dealloc__(((
struct __pyx_obj_10csmoothers_cASMFactor *)__pyx_v_self));
3157 __Pyx_RefNannyFinishContext();
3160 static void __pyx_pf_10csmoothers_10cASMFactor_2__dealloc__(
struct __pyx_obj_10csmoothers_cASMFactor *__pyx_v_self) {
3161 __Pyx_RefNannyDeclarations
3162 __Pyx_RefNannySetupContext(
"__dealloc__", 0);
3171 asm_NR_free(__pyx_v_self->N, __pyx_v_self->subdomain_dim, __pyx_v_self->l2g_L, __pyx_v_self->subdomain_L, __pyx_v_self->subdomain_R, __pyx_v_self->subdomain_dX, __pyx_v_self->subdomain_pivots);
3182 __Pyx_RefNannyFinishContext();
3192 static PyObject *__pyx_pw_10csmoothers_10cASMFactor_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
3193 static PyObject *__pyx_pw_10csmoothers_10cASMFactor_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
3194 PyObject *__pyx_r = 0;
3195 __Pyx_RefNannyDeclarations
3196 __Pyx_RefNannySetupContext(
"__reduce_cython__ (wrapper)", 0);
3197 __pyx_r = __pyx_pf_10csmoothers_10cASMFactor_4__reduce_cython__(((
struct __pyx_obj_10csmoothers_cASMFactor *)__pyx_v_self));
3200 __Pyx_RefNannyFinishContext();
3204 static PyObject *__pyx_pf_10csmoothers_10cASMFactor_4__reduce_cython__(CYTHON_UNUSED
struct __pyx_obj_10csmoothers_cASMFactor *__pyx_v_self) {
3205 PyObject *__pyx_r = NULL;
3206 __Pyx_RefNannyDeclarations
3207 PyObject *__pyx_t_1 = NULL;
3208 int __pyx_lineno = 0;
3209 const char *__pyx_filename = NULL;
3210 int __pyx_clineno = 0;
3211 __Pyx_RefNannySetupContext(
"__reduce_cython__", 0);
3219 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple_, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
3220 __Pyx_GOTREF(__pyx_t_1);
3221 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
3222 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3223 __PYX_ERR(1, 2, __pyx_L1_error)
3233 __Pyx_XDECREF(__pyx_t_1);
3234 __Pyx_AddTraceback(
"csmoothers.cASMFactor.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3236 __Pyx_XGIVEREF(__pyx_r);
3237 __Pyx_RefNannyFinishContext();
3249 static PyObject *__pyx_pw_10csmoothers_10cASMFactor_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state);
3250 static PyObject *__pyx_pw_10csmoothers_10cASMFactor_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
3251 PyObject *__pyx_r = 0;
3252 __Pyx_RefNannyDeclarations
3253 __Pyx_RefNannySetupContext(
"__setstate_cython__ (wrapper)", 0);
3254 __pyx_r = __pyx_pf_10csmoothers_10cASMFactor_6__setstate_cython__(((
struct __pyx_obj_10csmoothers_cASMFactor *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
3257 __Pyx_RefNannyFinishContext();
3261 static PyObject *__pyx_pf_10csmoothers_10cASMFactor_6__setstate_cython__(CYTHON_UNUSED
struct __pyx_obj_10csmoothers_cASMFactor *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
3262 PyObject *__pyx_r = NULL;
3263 __Pyx_RefNannyDeclarations
3264 PyObject *__pyx_t_1 = NULL;
3265 int __pyx_lineno = 0;
3266 const char *__pyx_filename = NULL;
3267 int __pyx_clineno = 0;
3268 __Pyx_RefNannySetupContext(
"__setstate_cython__", 0);
3275 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__2, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
3276 __Pyx_GOTREF(__pyx_t_1);
3277 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
3278 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3279 __PYX_ERR(1, 4, __pyx_L1_error)
3290 __Pyx_XDECREF(__pyx_t_1);
3291 __Pyx_AddTraceback(
"csmoothers.cASMFactor.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3293 __Pyx_XGIVEREF(__pyx_r);
3294 __Pyx_RefNannyFinishContext();
3307 static PyObject *__pyx_pw_10csmoothers_10BASMFactor_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
3308 static PyMethodDef __pyx_mdef_10csmoothers_10BASMFactor_1__init__ = {
"__init__", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_10csmoothers_10BASMFactor_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
3309 static PyObject *__pyx_pw_10csmoothers_10BASMFactor_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3310 PyObject *__pyx_v_self = 0;
3311 PyObject *__pyx_v_L = 0;
3312 PyObject *__pyx_v_bs = 0;
3313 int __pyx_lineno = 0;
3314 const char *__pyx_filename = NULL;
3315 int __pyx_clineno = 0;
3316 PyObject *__pyx_r = 0;
3317 __Pyx_RefNannyDeclarations
3318 __Pyx_RefNannySetupContext(
"__init__ (wrapper)", 0);
3320 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_L,&__pyx_n_s_bs,0};
3321 PyObject* values[3] = {0,0,0};
3322 if (unlikely(__pyx_kwds)) {
3324 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3326 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3328 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3330 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3333 default:
goto __pyx_L5_argtuple_error;
3335 kw_args = PyDict_Size(__pyx_kwds);
3338 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
3339 else goto __pyx_L5_argtuple_error;
3342 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_L)) != 0)) kw_args--;
3344 __Pyx_RaiseArgtupleInvalid(
"__init__", 1, 3, 3, 1); __PYX_ERR(0, 44, __pyx_L3_error)
3348 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bs)) != 0)) kw_args--;
3350 __Pyx_RaiseArgtupleInvalid(
"__init__", 1, 3, 3, 2); __PYX_ERR(0, 44, __pyx_L3_error)
3353 if (unlikely(kw_args > 0)) {
3354 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__init__") < 0)) __PYX_ERR(0, 44, __pyx_L3_error)
3356 }
else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
3357 goto __pyx_L5_argtuple_error;
3359 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3360 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3361 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3363 __pyx_v_self = values[0];
3364 __pyx_v_L = values[1];
3365 __pyx_v_bs = values[2];
3367 goto __pyx_L4_argument_unpacking_done;
3368 __pyx_L5_argtuple_error:;
3369 __Pyx_RaiseArgtupleInvalid(
"__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 44, __pyx_L3_error)
3371 __Pyx_AddTraceback(
"csmoothers.BASMFactor.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3372 __Pyx_RefNannyFinishContext();
3374 __pyx_L4_argument_unpacking_done:;
3375 __pyx_r = __pyx_pf_10csmoothers_10BASMFactor___init__(__pyx_self, __pyx_v_self, __pyx_v_L, __pyx_v_bs);
3378 __Pyx_RefNannyFinishContext();
3382 static PyObject *__pyx_pf_10csmoothers_10BASMFactor___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_L, PyObject *__pyx_v_bs) {
3383 PyObject *__pyx_r = NULL;
3384 __Pyx_RefNannyDeclarations
3385 PyObject *__pyx_t_1 = NULL;
3386 PyObject *__pyx_t_2 = NULL;
3387 PyObject *__pyx_t_3 = NULL;
3388 int __pyx_lineno = 0;
3389 const char *__pyx_filename = NULL;
3390 int __pyx_clineno = 0;
3391 __Pyx_RefNannySetupContext(
"__init__", 0);
3400 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_L, __pyx_v_L) < 0) __PYX_ERR(0, 45, __pyx_L1_error)
3409 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_bs, __pyx_v_bs) < 0) __PYX_ERR(0, 46, __pyx_L1_error)
3418 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_L);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error)
3419 __Pyx_GOTREF(__pyx_t_1);
3420 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_cSparseMatrix);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 47, __pyx_L1_error)
3421 __Pyx_GOTREF(__pyx_t_2);
3422 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3431 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_bs);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error)
3432 __Pyx_GOTREF(__pyx_t_1);
3441 __pyx_t_3 = PyTuple_New(2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 47, __pyx_L1_error)
3442 __Pyx_GOTREF(__pyx_t_3);
3443 __Pyx_GIVEREF(__pyx_t_2);
3444 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
3445 __Pyx_GIVEREF(__pyx_t_1);
3446 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
3449 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_10csmoothers_cBASMFactor), __pyx_t_3, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 47, __pyx_L1_error)
3450 __Pyx_GOTREF(__pyx_t_1);
3451 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3452 if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cBASMFactor, __pyx_t_1) < 0) __PYX_ERR(0, 47, __pyx_L1_error)
3453 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3464 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3467 __Pyx_XDECREF(__pyx_t_1);
3468 __Pyx_XDECREF(__pyx_t_2);
3469 __Pyx_XDECREF(__pyx_t_3);
3470 __Pyx_AddTraceback(
"csmoothers.BASMFactor.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3473 __Pyx_XGIVEREF(__pyx_r);
3474 __Pyx_RefNannyFinishContext();
3487 static int __pyx_pw_10csmoothers_11cBASMFactor_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
3488 static int __pyx_pw_10csmoothers_11cBASMFactor_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3489 struct __pyx_obj_7proteus_15superluWrappers_cSparseMatrix *__pyx_v_L = 0;
3491 int __pyx_lineno = 0;
3492 const char *__pyx_filename = NULL;
3493 int __pyx_clineno = 0;
3495 __Pyx_RefNannyDeclarations
3496 __Pyx_RefNannySetupContext(
"__cinit__ (wrapper)", 0);
3498 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_L,&__pyx_n_s_bs,0};
3499 PyObject* values[2] = {0,0};
3500 if (unlikely(__pyx_kwds)) {
3502 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3504 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3506 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3509 default:
goto __pyx_L5_argtuple_error;
3511 kw_args = PyDict_Size(__pyx_kwds);
3514 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_L)) != 0)) kw_args--;
3515 else goto __pyx_L5_argtuple_error;
3518 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bs)) != 0)) kw_args--;
3520 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 1, 2, 2, 1); __PYX_ERR(0, 52, __pyx_L3_error)
3523 if (unlikely(kw_args > 0)) {
3524 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__cinit__") < 0)) __PYX_ERR(0, 52, __pyx_L3_error)
3526 }
else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
3527 goto __pyx_L5_argtuple_error;
3529 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3530 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3532 __pyx_v_L = ((
struct __pyx_obj_7proteus_15superluWrappers_cSparseMatrix *)values[0]);
3533 __pyx_v_bs = __Pyx_PyInt_As_int(values[1]);
if (unlikely((__pyx_v_bs == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 54, __pyx_L3_error)
3535 goto __pyx_L4_argument_unpacking_done;
3536 __pyx_L5_argtuple_error:;
3537 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 52, __pyx_L3_error)
3539 __Pyx_AddTraceback(
"csmoothers.cBASMFactor.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3540 __Pyx_RefNannyFinishContext();
3542 __pyx_L4_argument_unpacking_done:;
3543 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_L), __pyx_ptype_7proteus_15superluWrappers_cSparseMatrix, 1,
"L", 0))) __PYX_ERR(0, 53, __pyx_L1_error)
3544 __pyx_r = __pyx_pf_10csmoothers_11cBASMFactor___cinit__(((
struct __pyx_obj_10csmoothers_cBASMFactor *)__pyx_v_self), __pyx_v_L, __pyx_v_bs);
3551 __Pyx_RefNannyFinishContext();
3555 static int __pyx_pf_10csmoothers_11cBASMFactor___cinit__(
struct __pyx_obj_10csmoothers_cBASMFactor *__pyx_v_self,
struct __pyx_obj_7proteus_15superluWrappers_cSparseMatrix *__pyx_v_L,
int __pyx_v_bs) {
3557 __pyx_t_10csmoothers_SuperMatrix __pyx_v_AS;
3559 __Pyx_RefNannyDeclarations
3560 PyObject *__pyx_t_1 = NULL;
3562 int __pyx_lineno = 0;
3563 const char *__pyx_filename = NULL;
3564 int __pyx_clineno = 0;
3565 __Pyx_RefNannySetupContext(
"__cinit__", 0);
3583 __pyx_v_AS.Stype = SLU_NR;
3592 __pyx_v_AS.Dtype = SLU_D;
3601 __pyx_v_AS.Mtype = SLU_GE;
3610 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_L), __pyx_n_s_nr);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error)
3611 __Pyx_GOTREF(__pyx_t_1);
3612 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 60, __pyx_L1_error)
3613 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3614 __pyx_v_AS.nrow = __pyx_t_2;
3623 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_L), __pyx_n_s_nc);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 61, __pyx_L1_error)
3624 __Pyx_GOTREF(__pyx_t_1);
3625 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 61, __pyx_L1_error)
3626 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3627 __pyx_v_AS.ncol = __pyx_t_2;
3636 __pyx_v_AS.Store = (&__pyx_v_L->A);
3645 __pyx_v_rval =
basm_NR_init(__pyx_v_bs, (&__pyx_v_AS), (&__pyx_v_self->subdomain_dim), (&__pyx_v_self->l2g_L), (&__pyx_v_self->subdomain_L), (&__pyx_v_self->subdomain_R), (&__pyx_v_self->subdomain_dX), (&__pyx_v_self->subdomain_pivots), (&__pyx_v_self->subdomain_col_pivots));
3654 #ifndef CYTHON_WITHOUT_ASSERTIONS
3655 if (unlikely(!Py_OptimizeFlag)) {
3656 if (unlikely(!((__pyx_v_rval == 0) != 0))) {
3657 PyErr_SetNone(PyExc_AssertionError);
3658 __PYX_ERR(0, 72, __pyx_L1_error)
3675 __Pyx_XDECREF(__pyx_t_1);
3676 __Pyx_AddTraceback(
"csmoothers.cBASMFactor.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3679 __Pyx_RefNannyFinishContext();
3692 static void __pyx_pw_10csmoothers_11cBASMFactor_3__dealloc__(PyObject *__pyx_v_self);
3693 static void __pyx_pw_10csmoothers_11cBASMFactor_3__dealloc__(PyObject *__pyx_v_self) {
3694 __Pyx_RefNannyDeclarations
3695 __Pyx_RefNannySetupContext(
"__dealloc__ (wrapper)", 0);
3696 __pyx_pf_10csmoothers_11cBASMFactor_2__dealloc__(((
struct __pyx_obj_10csmoothers_cBASMFactor *)__pyx_v_self));
3699 __Pyx_RefNannyFinishContext();
3702 static void __pyx_pf_10csmoothers_11cBASMFactor_2__dealloc__(
struct __pyx_obj_10csmoothers_cBASMFactor *__pyx_v_self) {
3703 __Pyx_RefNannyDeclarations
3704 __Pyx_RefNannySetupContext(
"__dealloc__", 0);
3713 basm_NR_free(__pyx_v_self->N, __pyx_v_self->subdomain_dim, __pyx_v_self->l2g_L, __pyx_v_self->subdomain_L, __pyx_v_self->subdomain_R, __pyx_v_self->subdomain_dX, __pyx_v_self->subdomain_pivots, __pyx_v_self->subdomain_col_pivots);
3724 __Pyx_RefNannyFinishContext();
3734 static PyObject *__pyx_pw_10csmoothers_11cBASMFactor_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
3735 static PyObject *__pyx_pw_10csmoothers_11cBASMFactor_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
3736 PyObject *__pyx_r = 0;
3737 __Pyx_RefNannyDeclarations
3738 __Pyx_RefNannySetupContext(
"__reduce_cython__ (wrapper)", 0);
3739 __pyx_r = __pyx_pf_10csmoothers_11cBASMFactor_4__reduce_cython__(((
struct __pyx_obj_10csmoothers_cBASMFactor *)__pyx_v_self));
3742 __Pyx_RefNannyFinishContext();
3746 static PyObject *__pyx_pf_10csmoothers_11cBASMFactor_4__reduce_cython__(CYTHON_UNUSED
struct __pyx_obj_10csmoothers_cBASMFactor *__pyx_v_self) {
3747 PyObject *__pyx_r = NULL;
3748 __Pyx_RefNannyDeclarations
3749 PyObject *__pyx_t_1 = NULL;
3750 int __pyx_lineno = 0;
3751 const char *__pyx_filename = NULL;
3752 int __pyx_clineno = 0;
3753 __Pyx_RefNannySetupContext(
"__reduce_cython__", 0);
3761 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
3762 __Pyx_GOTREF(__pyx_t_1);
3763 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
3764 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3765 __PYX_ERR(1, 2, __pyx_L1_error)
3775 __Pyx_XDECREF(__pyx_t_1);
3776 __Pyx_AddTraceback(
"csmoothers.cBASMFactor.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3778 __Pyx_XGIVEREF(__pyx_r);
3779 __Pyx_RefNannyFinishContext();
3791 static PyObject *__pyx_pw_10csmoothers_11cBASMFactor_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state);
3792 static PyObject *__pyx_pw_10csmoothers_11cBASMFactor_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
3793 PyObject *__pyx_r = 0;
3794 __Pyx_RefNannyDeclarations
3795 __Pyx_RefNannySetupContext(
"__setstate_cython__ (wrapper)", 0);
3796 __pyx_r = __pyx_pf_10csmoothers_11cBASMFactor_6__setstate_cython__(((
struct __pyx_obj_10csmoothers_cBASMFactor *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
3799 __Pyx_RefNannyFinishContext();
3803 static PyObject *__pyx_pf_10csmoothers_11cBASMFactor_6__setstate_cython__(CYTHON_UNUSED
struct __pyx_obj_10csmoothers_cBASMFactor *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
3804 PyObject *__pyx_r = NULL;
3805 __Pyx_RefNannyDeclarations
3806 PyObject *__pyx_t_1 = NULL;
3807 int __pyx_lineno = 0;
3808 const char *__pyx_filename = NULL;
3809 int __pyx_clineno = 0;
3810 __Pyx_RefNannySetupContext(
"__setstate_cython__", 0);
3817 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__4, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
3818 __Pyx_GOTREF(__pyx_t_1);
3819 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
3820 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3821 __PYX_ERR(1, 4, __pyx_L1_error)
3832 __Pyx_XDECREF(__pyx_t_1);
3833 __Pyx_AddTraceback(
"csmoothers.cBASMFactor.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3835 __Pyx_XGIVEREF(__pyx_r);
3836 __Pyx_RefNannyFinishContext();
3849 static PyObject *__pyx_pw_10csmoothers_1jacobi_NR_prepare(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
3850 static char __pyx_doc_10csmoothers_jacobi_NR_prepare[] =
"\n\n Arguments\n ---------\n A : superluWrappers.SparseMatrix\n w : double\n tol : double\n M : np.array\n ";
3851 static PyMethodDef __pyx_mdef_10csmoothers_1jacobi_NR_prepare = {
"jacobi_NR_prepare", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_10csmoothers_1jacobi_NR_prepare, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10csmoothers_jacobi_NR_prepare};
3852 static PyObject *__pyx_pw_10csmoothers_1jacobi_NR_prepare(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3853 PyObject *__pyx_v_A = 0;
3854 PyObject *__pyx_v_w = 0;
3855 PyObject *__pyx_v_tol = 0;
3856 PyObject *__pyx_v_M = 0;
3857 int __pyx_lineno = 0;
3858 const char *__pyx_filename = NULL;
3859 int __pyx_clineno = 0;
3860 PyObject *__pyx_r = 0;
3861 __Pyx_RefNannyDeclarations
3862 __Pyx_RefNannySetupContext(
"jacobi_NR_prepare (wrapper)", 0);
3864 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_A,&__pyx_n_s_w,&__pyx_n_s_tol,&__pyx_n_s_M,0};
3865 PyObject* values[4] = {0,0,0,0};
3866 if (unlikely(__pyx_kwds)) {
3868 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3870 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3872 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3874 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3876 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3879 default:
goto __pyx_L5_argtuple_error;
3881 kw_args = PyDict_Size(__pyx_kwds);
3884 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_A)) != 0)) kw_args--;
3885 else goto __pyx_L5_argtuple_error;
3888 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
3890 __Pyx_RaiseArgtupleInvalid(
"jacobi_NR_prepare", 1, 4, 4, 1); __PYX_ERR(0, 84, __pyx_L3_error)
3894 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tol)) != 0)) kw_args--;
3896 __Pyx_RaiseArgtupleInvalid(
"jacobi_NR_prepare", 1, 4, 4, 2); __PYX_ERR(0, 84, __pyx_L3_error)
3900 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_M)) != 0)) kw_args--;
3902 __Pyx_RaiseArgtupleInvalid(
"jacobi_NR_prepare", 1, 4, 4, 3); __PYX_ERR(0, 84, __pyx_L3_error)
3905 if (unlikely(kw_args > 0)) {
3906 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"jacobi_NR_prepare") < 0)) __PYX_ERR(0, 84, __pyx_L3_error)
3908 }
else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
3909 goto __pyx_L5_argtuple_error;
3911 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3912 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3913 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
3914 values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
3916 __pyx_v_A = values[0];
3917 __pyx_v_w = values[1];
3918 __pyx_v_tol = values[2];
3919 __pyx_v_M = values[3];
3921 goto __pyx_L4_argument_unpacking_done;
3922 __pyx_L5_argtuple_error:;
3923 __Pyx_RaiseArgtupleInvalid(
"jacobi_NR_prepare", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 84, __pyx_L3_error)
3925 __Pyx_AddTraceback(
"csmoothers.jacobi_NR_prepare", __pyx_clineno, __pyx_lineno, __pyx_filename);
3926 __Pyx_RefNannyFinishContext();
3928 __pyx_L4_argument_unpacking_done:;
3929 __pyx_r = __pyx_pf_10csmoothers_jacobi_NR_prepare(__pyx_self, __pyx_v_A, __pyx_v_w, __pyx_v_tol, __pyx_v_M);
3932 __Pyx_RefNannyFinishContext();
3936 static PyObject *__pyx_pf_10csmoothers_jacobi_NR_prepare(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_w, PyObject *__pyx_v_tol, PyObject *__pyx_v_M) {
3937 PyObject *__pyx_r = NULL;
3938 __Pyx_RefNannyDeclarations
3939 PyObject *__pyx_t_1 = NULL;
3942 __pyx_t_10csmoothers_DDATA __pyx_t_4 = { 0, 0, { 0 }, { 0 }, { 0 } };
3943 int __pyx_lineno = 0;
3944 const char *__pyx_filename = NULL;
3945 int __pyx_clineno = 0;
3946 __Pyx_RefNannySetupContext(
"jacobi_NR_prepare", 0);
3955 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_A, __pyx_n_s_cSparseMatrix);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 94, __pyx_L1_error)
3956 __Pyx_GOTREF(__pyx_t_1);
3957 if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7proteus_15superluWrappers_cSparseMatrix))))) __PYX_ERR(0, 94, __pyx_L1_error)
3958 __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_w);
if (unlikely((__pyx_t_2 == (
double)-1) && PyErr_Occurred())) __PYX_ERR(0, 94, __pyx_L1_error)
3959 __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_v_tol);
if (unlikely((__pyx_t_3 == (
double)-1) && PyErr_Occurred())) __PYX_ERR(0, 94, __pyx_L1_error)
3960 __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_M, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 94, __pyx_L1_error)
3961 __pyx_f_10csmoothers_smootherWrappersjacobi_NR_prepare(((
struct __pyx_obj_7proteus_15superluWrappers_cSparseMatrix *)__pyx_t_1), __pyx_t_2, __pyx_t_3, __pyx_t_4);
3962 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3963 __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1);
3964 __pyx_t_4.memview = NULL;
3965 __pyx_t_4.data = NULL;
3976 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3979 __Pyx_XDECREF(__pyx_t_1);
3980 __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1);
3981 __Pyx_AddTraceback(
"csmoothers.jacobi_NR_prepare", __pyx_clineno, __pyx_lineno, __pyx_filename);
3984 __Pyx_XGIVEREF(__pyx_r);
3985 __Pyx_RefNannyFinishContext();
3997 static void __pyx_f_10csmoothers_smootherWrappersjacobi_NR_prepare(
struct __pyx_obj_7proteus_15superluWrappers_cSparseMatrix *__pyx_v_sm,
double __pyx_v_w,
double __pyx_v_tol, __pyx_t_10csmoothers_DDATA __pyx_v_M) {
3998 __pyx_t_10csmoothers_SuperMatrix __pyx_v_AS;
3999 __Pyx_RefNannyDeclarations
4000 PyObject *__pyx_t_1 = NULL;
4002 Py_ssize_t __pyx_t_3;
4003 int __pyx_lineno = 0;
4004 const char *__pyx_filename = NULL;
4005 int __pyx_clineno = 0;
4006 __Pyx_RefNannySetupContext(
"smootherWrappersjacobi_NR_prepare", 0);
4015 __pyx_v_AS.Stype = SLU_NR;
4024 __pyx_v_AS.Dtype = SLU_D;
4033 __pyx_v_AS.Mtype = SLU_GE;
4042 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_sm), __pyx_n_s_nr);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 104, __pyx_L1_error)
4043 __Pyx_GOTREF(__pyx_t_1);
4044 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 104, __pyx_L1_error)
4045 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4046 __pyx_v_AS.nrow = __pyx_t_2;
4055 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_sm), __pyx_n_s_nc);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 105, __pyx_L1_error)
4056 __Pyx_GOTREF(__pyx_t_1);
4057 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 105, __pyx_L1_error)
4058 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4059 __pyx_v_AS.ncol = __pyx_t_2;
4068 __pyx_v_AS.Store = (&__pyx_v_sm->A);
4079 if (__pyx_t_3 < 0) {
4080 __pyx_t_3 += __pyx_v_M.shape[0];
4081 if (unlikely(__pyx_t_3 < 0)) __pyx_t_2 = 0;
4082 }
else if (unlikely(__pyx_t_3 >= __pyx_v_M.shape[0])) __pyx_t_2 = 0;
4083 if (unlikely(__pyx_t_2 != -1)) {
4084 __Pyx_RaiseBufferIndexError(__pyx_t_2);
4085 __PYX_ERR(0, 107, __pyx_L1_error)
4087 jacobi_NR_prepare((&__pyx_v_AS), __pyx_v_w, __pyx_v_tol, (&(*((
double *) ( (__pyx_v_M.data + __pyx_t_3 * __pyx_v_M.strides[0]) )))));
4100 __Pyx_XDECREF(__pyx_t_1);
4101 __Pyx_WriteUnraisable(
"csmoothers.smootherWrappersjacobi_NR_prepare", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
4103 __Pyx_RefNannyFinishContext();
4115 static PyObject *__pyx_pw_10csmoothers_3jacobi_NR_solve(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
4116 static char __pyx_doc_10csmoothers_2jacobi_NR_solve[] =
"\n \n Arguments\n ---------\n A : superluWrappers.SparseMatrix\n M : np.array double\n R : np.array double\n node_order : np.array int\n dX : np.array double\n ";
4117 static PyMethodDef __pyx_mdef_10csmoothers_3jacobi_NR_solve = {
"jacobi_NR_solve", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_10csmoothers_3jacobi_NR_solve, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10csmoothers_2jacobi_NR_solve};
4118 static PyObject *__pyx_pw_10csmoothers_3jacobi_NR_solve(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4119 PyObject *__pyx_v_A = 0;
4120 PyObject *__pyx_v_M = 0;
4121 PyObject *__pyx_v_R = 0;
4122 PyObject *__pyx_v_node_order = 0;
4123 PyObject *__pyx_v_dX = 0;
4124 int __pyx_lineno = 0;
4125 const char *__pyx_filename = NULL;
4126 int __pyx_clineno = 0;
4127 PyObject *__pyx_r = 0;
4128 __Pyx_RefNannyDeclarations
4129 __Pyx_RefNannySetupContext(
"jacobi_NR_solve (wrapper)", 0);
4131 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_A,&__pyx_n_s_M,&__pyx_n_s_R,&__pyx_n_s_node_order,&__pyx_n_s_dX,0};
4132 PyObject* values[5] = {0,0,0,0,0};
4133 if (unlikely(__pyx_kwds)) {
4135 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4137 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4139 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4141 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4143 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4145 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4148 default:
goto __pyx_L5_argtuple_error;
4150 kw_args = PyDict_Size(__pyx_kwds);
4153 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_A)) != 0)) kw_args--;
4154 else goto __pyx_L5_argtuple_error;
4157 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_M)) != 0)) kw_args--;
4159 __Pyx_RaiseArgtupleInvalid(
"jacobi_NR_solve", 1, 5, 5, 1); __PYX_ERR(0, 109, __pyx_L3_error)
4163 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_R)) != 0)) kw_args--;
4165 __Pyx_RaiseArgtupleInvalid(
"jacobi_NR_solve", 1, 5, 5, 2); __PYX_ERR(0, 109, __pyx_L3_error)
4169 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_node_order)) != 0)) kw_args--;
4171 __Pyx_RaiseArgtupleInvalid(
"jacobi_NR_solve", 1, 5, 5, 3); __PYX_ERR(0, 109, __pyx_L3_error)
4175 if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dX)) != 0)) kw_args--;
4177 __Pyx_RaiseArgtupleInvalid(
"jacobi_NR_solve", 1, 5, 5, 4); __PYX_ERR(0, 109, __pyx_L3_error)
4180 if (unlikely(kw_args > 0)) {
4181 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"jacobi_NR_solve") < 0)) __PYX_ERR(0, 109, __pyx_L3_error)
4183 }
else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
4184 goto __pyx_L5_argtuple_error;
4186 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4187 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4188 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4189 values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4190 values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4192 __pyx_v_A = values[0];
4193 __pyx_v_M = values[1];
4194 __pyx_v_R = values[2];
4195 __pyx_v_node_order = values[3];
4196 __pyx_v_dX = values[4];
4198 goto __pyx_L4_argument_unpacking_done;
4199 __pyx_L5_argtuple_error:;
4200 __Pyx_RaiseArgtupleInvalid(
"jacobi_NR_solve", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 109, __pyx_L3_error)
4202 __Pyx_AddTraceback(
"csmoothers.jacobi_NR_solve", __pyx_clineno, __pyx_lineno, __pyx_filename);
4203 __Pyx_RefNannyFinishContext();
4205 __pyx_L4_argument_unpacking_done:;
4206 __pyx_r = __pyx_pf_10csmoothers_2jacobi_NR_solve(__pyx_self, __pyx_v_A, __pyx_v_M, __pyx_v_R, __pyx_v_node_order, __pyx_v_dX);
4209 __Pyx_RefNannyFinishContext();
4213 static PyObject *__pyx_pf_10csmoothers_2jacobi_NR_solve(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_M, PyObject *__pyx_v_R, PyObject *__pyx_v_node_order, PyObject *__pyx_v_dX) {
4214 PyObject *__pyx_r = NULL;
4215 __Pyx_RefNannyDeclarations
4216 PyObject *__pyx_t_1 = NULL;
4217 __pyx_t_10csmoothers_DDATA __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } };
4218 __pyx_t_10csmoothers_DDATA __pyx_t_3 = { 0, 0, { 0 }, { 0 }, { 0 } };
4219 __pyx_t_10csmoothers_IDATA __pyx_t_4 = { 0, 0, { 0 }, { 0 }, { 0 } };
4220 __pyx_t_10csmoothers_DDATA __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
4221 int __pyx_lineno = 0;
4222 const char *__pyx_filename = NULL;
4223 int __pyx_clineno = 0;
4224 __Pyx_RefNannySetupContext(
"jacobi_NR_solve", 0);
4233 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_A, __pyx_n_s_cSparseMatrix);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 120, __pyx_L1_error)
4234 __Pyx_GOTREF(__pyx_t_1);
4235 if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7proteus_15superluWrappers_cSparseMatrix))))) __PYX_ERR(0, 120, __pyx_L1_error)
4236 __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_M, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 120, __pyx_L1_error)
4237 __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_R, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 120, __pyx_L1_error)
4238 __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_v_node_order, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 120, __pyx_L1_error)
4239 __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_dX, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 120, __pyx_L1_error)
4240 __pyx_f_10csmoothers_smootherWrappersjacobi_NR_solve(((
struct __pyx_obj_7proteus_15superluWrappers_cSparseMatrix *)__pyx_t_1), __pyx_t_2, __pyx_t_3, __pyx_t_4, __pyx_t_5);
4241 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4242 __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1);
4243 __pyx_t_2.memview = NULL;
4244 __pyx_t_2.data = NULL;
4245 __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
4246 __pyx_t_3.memview = NULL;
4247 __pyx_t_3.data = NULL;
4248 __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1);
4249 __pyx_t_4.memview = NULL;
4250 __pyx_t_4.data = NULL;
4251 __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
4252 __pyx_t_5.memview = NULL;
4253 __pyx_t_5.data = NULL;
4264 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4267 __Pyx_XDECREF(__pyx_t_1);
4268 __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1);
4269 __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
4270 __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1);
4271 __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
4272 __Pyx_AddTraceback(
"csmoothers.jacobi_NR_solve", __pyx_clineno, __pyx_lineno, __pyx_filename);
4275 __Pyx_XGIVEREF(__pyx_r);
4276 __Pyx_RefNannyFinishContext();
4288 static void __pyx_f_10csmoothers_smootherWrappersjacobi_NR_solve(
struct __pyx_obj_7proteus_15superluWrappers_cSparseMatrix *__pyx_v_sm, __pyx_t_10csmoothers_DDATA __pyx_v_M, __pyx_t_10csmoothers_DDATA __pyx_v_R, __pyx_t_10csmoothers_IDATA __pyx_v_node_order, __pyx_t_10csmoothers_DDATA __pyx_v_dX) {
4289 __pyx_t_10csmoothers_SuperMatrix __pyx_v_AS;
4290 __Pyx_RefNannyDeclarations
4291 PyObject *__pyx_t_1 = NULL;
4293 Py_ssize_t __pyx_t_3;
4294 Py_ssize_t __pyx_t_4;
4295 Py_ssize_t __pyx_t_5;
4296 Py_ssize_t __pyx_t_6;
4297 int __pyx_lineno = 0;
4298 const char *__pyx_filename = NULL;
4299 int __pyx_clineno = 0;
4300 __Pyx_RefNannySetupContext(
"smootherWrappersjacobi_NR_solve", 0);
4309 __pyx_v_AS.Stype = SLU_NR;
4318 __pyx_v_AS.Dtype = SLU_D;
4327 __pyx_v_AS.Mtype = SLU_GE;
4336 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_sm), __pyx_n_s_nr);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 131, __pyx_L1_error)
4337 __Pyx_GOTREF(__pyx_t_1);
4338 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 131, __pyx_L1_error)
4339 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4340 __pyx_v_AS.nrow = __pyx_t_2;
4349 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_sm), __pyx_n_s_nc);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 132, __pyx_L1_error)
4350 __Pyx_GOTREF(__pyx_t_1);
4351 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 132, __pyx_L1_error)
4352 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4353 __pyx_v_AS.ncol = __pyx_t_2;
4362 __pyx_v_AS.Store = (&__pyx_v_sm->A);
4373 if (__pyx_t_3 < 0) {
4374 __pyx_t_3 += __pyx_v_M.shape[0];
4375 if (unlikely(__pyx_t_3 < 0)) __pyx_t_2 = 0;
4376 }
else if (unlikely(__pyx_t_3 >= __pyx_v_M.shape[0])) __pyx_t_2 = 0;
4377 if (unlikely(__pyx_t_2 != -1)) {
4378 __Pyx_RaiseBufferIndexError(__pyx_t_2);
4379 __PYX_ERR(0, 134, __pyx_L1_error)
4383 if (__pyx_t_4 < 0) {
4384 __pyx_t_4 += __pyx_v_R.shape[0];
4385 if (unlikely(__pyx_t_4 < 0)) __pyx_t_2 = 0;
4386 }
else if (unlikely(__pyx_t_4 >= __pyx_v_R.shape[0])) __pyx_t_2 = 0;
4387 if (unlikely(__pyx_t_2 != -1)) {
4388 __Pyx_RaiseBufferIndexError(__pyx_t_2);
4389 __PYX_ERR(0, 134, __pyx_L1_error)
4393 if (__pyx_t_5 < 0) {
4394 __pyx_t_5 += __pyx_v_node_order.shape[0];
4395 if (unlikely(__pyx_t_5 < 0)) __pyx_t_2 = 0;
4396 }
else if (unlikely(__pyx_t_5 >= __pyx_v_node_order.shape[0])) __pyx_t_2 = 0;
4397 if (unlikely(__pyx_t_2 != -1)) {
4398 __Pyx_RaiseBufferIndexError(__pyx_t_2);
4399 __PYX_ERR(0, 134, __pyx_L1_error)
4403 if (__pyx_t_6 < 0) {
4404 __pyx_t_6 += __pyx_v_dX.shape[0];
4405 if (unlikely(__pyx_t_6 < 0)) __pyx_t_2 = 0;
4406 }
else if (unlikely(__pyx_t_6 >= __pyx_v_dX.shape[0])) __pyx_t_2 = 0;
4407 if (unlikely(__pyx_t_2 != -1)) {
4408 __Pyx_RaiseBufferIndexError(__pyx_t_2);
4409 __PYX_ERR(0, 134, __pyx_L1_error)
4411 jacobi_NR_solve((&__pyx_v_AS), (&(*((
double *) ( (__pyx_v_M.data + __pyx_t_3 * __pyx_v_M.strides[0]) )))), (&(*((
double *) ( (__pyx_v_R.data + __pyx_t_4 * __pyx_v_R.strides[0]) )))), (&(*((
int *) ( (__pyx_v_node_order.data + __pyx_t_5 * __pyx_v_node_order.strides[0]) )))), (&(*((
double *) ( (__pyx_v_dX.data + __pyx_t_6 * __pyx_v_dX.strides[0]) )))));
4424 __Pyx_XDECREF(__pyx_t_1);
4425 __Pyx_WriteUnraisable(
"csmoothers.smootherWrappersjacobi_NR_solve", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
4427 __Pyx_RefNannyFinishContext();
4439 static PyObject *__pyx_pw_10csmoothers_5nl_jacobi_NR_solve(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
4440 static char __pyx_doc_10csmoothers_4nl_jacobi_NR_solve[] =
"\n\n Arguments\n ---------\n A : superluWrappers.SparseMatrix\n R : np.array double\n node_order : np.array int\n w : np.float\n tol : np.float\n dX : np.array double\n ";
4441 static PyMethodDef __pyx_mdef_10csmoothers_5nl_jacobi_NR_solve = {
"nl_jacobi_NR_solve", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_10csmoothers_5nl_jacobi_NR_solve, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10csmoothers_4nl_jacobi_NR_solve};
4442 static PyObject *__pyx_pw_10csmoothers_5nl_jacobi_NR_solve(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4443 PyObject *__pyx_v_A = 0;
4444 PyObject *__pyx_v_R = 0;
4445 PyObject *__pyx_v_node_order = 0;
4446 PyObject *__pyx_v_w = 0;
4447 PyObject *__pyx_v_tol = 0;
4448 PyObject *__pyx_v_dX = 0;
4449 int __pyx_lineno = 0;
4450 const char *__pyx_filename = NULL;
4451 int __pyx_clineno = 0;
4452 PyObject *__pyx_r = 0;
4453 __Pyx_RefNannyDeclarations
4454 __Pyx_RefNannySetupContext(
"nl_jacobi_NR_solve (wrapper)", 0);
4456 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_A,&__pyx_n_s_R,&__pyx_n_s_node_order,&__pyx_n_s_w,&__pyx_n_s_tol,&__pyx_n_s_dX,0};
4457 PyObject* values[6] = {0,0,0,0,0,0};
4458 if (unlikely(__pyx_kwds)) {
4460 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4462 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
4464 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4466 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4468 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4470 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4472 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4475 default:
goto __pyx_L5_argtuple_error;
4477 kw_args = PyDict_Size(__pyx_kwds);
4480 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_A)) != 0)) kw_args--;
4481 else goto __pyx_L5_argtuple_error;
4484 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_R)) != 0)) kw_args--;
4486 __Pyx_RaiseArgtupleInvalid(
"nl_jacobi_NR_solve", 1, 6, 6, 1); __PYX_ERR(0, 136, __pyx_L3_error)
4490 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_node_order)) != 0)) kw_args--;
4492 __Pyx_RaiseArgtupleInvalid(
"nl_jacobi_NR_solve", 1, 6, 6, 2); __PYX_ERR(0, 136, __pyx_L3_error)
4496 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
4498 __Pyx_RaiseArgtupleInvalid(
"nl_jacobi_NR_solve", 1, 6, 6, 3); __PYX_ERR(0, 136, __pyx_L3_error)
4502 if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tol)) != 0)) kw_args--;
4504 __Pyx_RaiseArgtupleInvalid(
"nl_jacobi_NR_solve", 1, 6, 6, 4); __PYX_ERR(0, 136, __pyx_L3_error)
4508 if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dX)) != 0)) kw_args--;
4510 __Pyx_RaiseArgtupleInvalid(
"nl_jacobi_NR_solve", 1, 6, 6, 5); __PYX_ERR(0, 136, __pyx_L3_error)
4513 if (unlikely(kw_args > 0)) {
4514 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"nl_jacobi_NR_solve") < 0)) __PYX_ERR(0, 136, __pyx_L3_error)
4516 }
else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
4517 goto __pyx_L5_argtuple_error;
4519 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4520 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4521 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4522 values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4523 values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4524 values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
4526 __pyx_v_A = values[0];
4527 __pyx_v_R = values[1];
4528 __pyx_v_node_order = values[2];
4529 __pyx_v_w = values[3];
4530 __pyx_v_tol = values[4];
4531 __pyx_v_dX = values[5];
4533 goto __pyx_L4_argument_unpacking_done;
4534 __pyx_L5_argtuple_error:;
4535 __Pyx_RaiseArgtupleInvalid(
"nl_jacobi_NR_solve", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 136, __pyx_L3_error)
4537 __Pyx_AddTraceback(
"csmoothers.nl_jacobi_NR_solve", __pyx_clineno, __pyx_lineno, __pyx_filename);
4538 __Pyx_RefNannyFinishContext();
4540 __pyx_L4_argument_unpacking_done:;
4541 __pyx_r = __pyx_pf_10csmoothers_4nl_jacobi_NR_solve(__pyx_self, __pyx_v_A, __pyx_v_R, __pyx_v_node_order, __pyx_v_w, __pyx_v_tol, __pyx_v_dX);
4544 __Pyx_RefNannyFinishContext();
4548 static PyObject *__pyx_pf_10csmoothers_4nl_jacobi_NR_solve(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_R, PyObject *__pyx_v_node_order, PyObject *__pyx_v_w, PyObject *__pyx_v_tol, PyObject *__pyx_v_dX) {
4549 PyObject *__pyx_r = NULL;
4550 __Pyx_RefNannyDeclarations
4551 PyObject *__pyx_t_1 = NULL;
4552 __pyx_t_10csmoothers_DDATA __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } };
4553 __pyx_t_10csmoothers_IDATA __pyx_t_3 = { 0, 0, { 0 }, { 0 }, { 0 } };
4556 __pyx_t_10csmoothers_DDATA __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
4557 int __pyx_lineno = 0;
4558 const char *__pyx_filename = NULL;
4559 int __pyx_clineno = 0;
4560 __Pyx_RefNannySetupContext(
"nl_jacobi_NR_solve", 0);
4569 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_A, __pyx_n_s_cSparseMatrix);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error)
4570 __Pyx_GOTREF(__pyx_t_1);
4571 if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7proteus_15superluWrappers_cSparseMatrix))))) __PYX_ERR(0, 148, __pyx_L1_error)
4572 __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_R, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 148, __pyx_L1_error)
4573 __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_v_node_order, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 148, __pyx_L1_error)
4574 __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_w);
if (unlikely((__pyx_t_4 == (
double)-1) && PyErr_Occurred())) __PYX_ERR(0, 148, __pyx_L1_error)
4575 __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_tol);
if (unlikely((__pyx_t_5 == (
double)-1) && PyErr_Occurred())) __PYX_ERR(0, 148, __pyx_L1_error)
4576 __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_dX, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 148, __pyx_L1_error)
4577 __pyx_f_10csmoothers_smootherWrappersnl_jacobi_NR_solve(((
struct __pyx_obj_7proteus_15superluWrappers_cSparseMatrix *)__pyx_t_1), __pyx_t_2, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6);
4578 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4579 __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1);
4580 __pyx_t_2.memview = NULL;
4581 __pyx_t_2.data = NULL;
4582 __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
4583 __pyx_t_3.memview = NULL;
4584 __pyx_t_3.data = NULL;
4585 __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
4586 __pyx_t_6.memview = NULL;
4587 __pyx_t_6.data = NULL;
4598 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4601 __Pyx_XDECREF(__pyx_t_1);
4602 __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1);
4603 __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
4604 __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
4605 __Pyx_AddTraceback(
"csmoothers.nl_jacobi_NR_solve", __pyx_clineno, __pyx_lineno, __pyx_filename);
4608 __Pyx_XGIVEREF(__pyx_r);
4609 __Pyx_RefNannyFinishContext();
4621 static void __pyx_f_10csmoothers_smootherWrappersnl_jacobi_NR_solve(
struct __pyx_obj_7proteus_15superluWrappers_cSparseMatrix *__pyx_v_sm, __pyx_t_10csmoothers_DDATA __pyx_v_R, __pyx_t_10csmoothers_IDATA __pyx_v_node_order,
double __pyx_v_w,
double __pyx_v_tol, __pyx_t_10csmoothers_DDATA __pyx_v_dX) {
4622 __pyx_t_10csmoothers_SuperMatrix __pyx_v_AS;
4623 __Pyx_RefNannyDeclarations
4624 PyObject *__pyx_t_1 = NULL;
4626 Py_ssize_t __pyx_t_3;
4627 Py_ssize_t __pyx_t_4;
4628 Py_ssize_t __pyx_t_5;
4629 int __pyx_lineno = 0;
4630 const char *__pyx_filename = NULL;
4631 int __pyx_clineno = 0;
4632 __Pyx_RefNannySetupContext(
"smootherWrappersnl_jacobi_NR_solve", 0);
4641 __pyx_v_AS.Stype = SLU_NR;
4650 __pyx_v_AS.Dtype = SLU_D;
4659 __pyx_v_AS.Mtype = SLU_GE;
4668 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_sm), __pyx_n_s_nr);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error)
4669 __Pyx_GOTREF(__pyx_t_1);
4670 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 160, __pyx_L1_error)
4671 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4672 __pyx_v_AS.nrow = __pyx_t_2;
4681 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_sm), __pyx_n_s_nc);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 161, __pyx_L1_error)
4682 __Pyx_GOTREF(__pyx_t_1);
4683 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 161, __pyx_L1_error)
4684 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4685 __pyx_v_AS.ncol = __pyx_t_2;
4694 __pyx_v_AS.Store = (&__pyx_v_sm->A);
4705 if (__pyx_t_3 < 0) {
4706 __pyx_t_3 += __pyx_v_R.shape[0];
4707 if (unlikely(__pyx_t_3 < 0)) __pyx_t_2 = 0;
4708 }
else if (unlikely(__pyx_t_3 >= __pyx_v_R.shape[0])) __pyx_t_2 = 0;
4709 if (unlikely(__pyx_t_2 != -1)) {
4710 __Pyx_RaiseBufferIndexError(__pyx_t_2);
4711 __PYX_ERR(0, 163, __pyx_L1_error)
4715 if (__pyx_t_4 < 0) {
4716 __pyx_t_4 += __pyx_v_node_order.shape[0];
4717 if (unlikely(__pyx_t_4 < 0)) __pyx_t_2 = 0;
4718 }
else if (unlikely(__pyx_t_4 >= __pyx_v_node_order.shape[0])) __pyx_t_2 = 0;
4719 if (unlikely(__pyx_t_2 != -1)) {
4720 __Pyx_RaiseBufferIndexError(__pyx_t_2);
4721 __PYX_ERR(0, 163, __pyx_L1_error)
4725 if (__pyx_t_5 < 0) {
4726 __pyx_t_5 += __pyx_v_dX.shape[0];
4727 if (unlikely(__pyx_t_5 < 0)) __pyx_t_2 = 0;
4728 }
else if (unlikely(__pyx_t_5 >= __pyx_v_dX.shape[0])) __pyx_t_2 = 0;
4729 if (unlikely(__pyx_t_2 != -1)) {
4730 __Pyx_RaiseBufferIndexError(__pyx_t_2);
4731 __PYX_ERR(0, 163, __pyx_L1_error)
4733 nl_jacobi_NR_solve((&__pyx_v_AS), (&(*((
double *) ( (__pyx_v_R.data + __pyx_t_3 * __pyx_v_R.strides[0]) )))), (&(*((
int *) ( (__pyx_v_node_order.data + __pyx_t_4 * __pyx_v_node_order.strides[0]) )))), __pyx_v_w, __pyx_v_tol, (&(*((
double *) ( (__pyx_v_dX.data + __pyx_t_5 * __pyx_v_dX.strides[0]) )))));
4746 __Pyx_XDECREF(__pyx_t_1);
4747 __Pyx_WriteUnraisable(
"csmoothers.smootherWrappersnl_jacobi_NR_solve", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
4749 __Pyx_RefNannyFinishContext();
4761 static PyObject *__pyx_pw_10csmoothers_7gauss_seidel_NR_preare(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
4762 static char __pyx_doc_10csmoothers_6gauss_seidel_NR_preare[] =
"\n\n Arguments\n ---------\n A :\n w :\n tol :\n M :\n ";
4763 static PyMethodDef __pyx_mdef_10csmoothers_7gauss_seidel_NR_preare = {
"gauss_seidel_NR_preare", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_10csmoothers_7gauss_seidel_NR_preare, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10csmoothers_6gauss_seidel_NR_preare};
4764 static PyObject *__pyx_pw_10csmoothers_7gauss_seidel_NR_preare(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4765 PyObject *__pyx_v_A = 0;
4766 PyObject *__pyx_v_w = 0;
4767 PyObject *__pyx_v_tol = 0;
4768 PyObject *__pyx_v_M = 0;
4769 int __pyx_lineno = 0;
4770 const char *__pyx_filename = NULL;
4771 int __pyx_clineno = 0;
4772 PyObject *__pyx_r = 0;
4773 __Pyx_RefNannyDeclarations
4774 __Pyx_RefNannySetupContext(
"gauss_seidel_NR_preare (wrapper)", 0);
4776 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_A,&__pyx_n_s_w,&__pyx_n_s_tol,&__pyx_n_s_M,0};
4777 PyObject* values[4] = {0,0,0,0};
4778 if (unlikely(__pyx_kwds)) {
4780 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4782 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4784 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4786 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4788 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4791 default:
goto __pyx_L5_argtuple_error;
4793 kw_args = PyDict_Size(__pyx_kwds);
4796 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_A)) != 0)) kw_args--;
4797 else goto __pyx_L5_argtuple_error;
4800 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
4802 __Pyx_RaiseArgtupleInvalid(
"gauss_seidel_NR_preare", 1, 4, 4, 1); __PYX_ERR(0, 165, __pyx_L3_error)
4806 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tol)) != 0)) kw_args--;
4808 __Pyx_RaiseArgtupleInvalid(
"gauss_seidel_NR_preare", 1, 4, 4, 2); __PYX_ERR(0, 165, __pyx_L3_error)
4812 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_M)) != 0)) kw_args--;
4814 __Pyx_RaiseArgtupleInvalid(
"gauss_seidel_NR_preare", 1, 4, 4, 3); __PYX_ERR(0, 165, __pyx_L3_error)
4817 if (unlikely(kw_args > 0)) {
4818 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"gauss_seidel_NR_preare") < 0)) __PYX_ERR(0, 165, __pyx_L3_error)
4820 }
else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
4821 goto __pyx_L5_argtuple_error;
4823 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4824 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4825 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4826 values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4828 __pyx_v_A = values[0];
4829 __pyx_v_w = values[1];
4830 __pyx_v_tol = values[2];
4831 __pyx_v_M = values[3];
4833 goto __pyx_L4_argument_unpacking_done;
4834 __pyx_L5_argtuple_error:;
4835 __Pyx_RaiseArgtupleInvalid(
"gauss_seidel_NR_preare", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 165, __pyx_L3_error)
4837 __Pyx_AddTraceback(
"csmoothers.gauss_seidel_NR_preare", __pyx_clineno, __pyx_lineno, __pyx_filename);
4838 __Pyx_RefNannyFinishContext();
4840 __pyx_L4_argument_unpacking_done:;
4841 __pyx_r = __pyx_pf_10csmoothers_6gauss_seidel_NR_preare(__pyx_self, __pyx_v_A, __pyx_v_w, __pyx_v_tol, __pyx_v_M);
4844 __Pyx_RefNannyFinishContext();
4848 static PyObject *__pyx_pf_10csmoothers_6gauss_seidel_NR_preare(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_w, PyObject *__pyx_v_tol, PyObject *__pyx_v_M) {
4849 PyObject *__pyx_r = NULL;
4850 __Pyx_RefNannyDeclarations
4851 PyObject *__pyx_t_1 = NULL;
4854 __pyx_t_10csmoothers_DDATA __pyx_t_4 = { 0, 0, { 0 }, { 0 }, { 0 } };
4855 int __pyx_lineno = 0;
4856 const char *__pyx_filename = NULL;
4857 int __pyx_clineno = 0;
4858 __Pyx_RefNannySetupContext(
"gauss_seidel_NR_preare", 0);
4867 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_A, __pyx_n_s_cSparseMatrix);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 175, __pyx_L1_error)
4868 __Pyx_GOTREF(__pyx_t_1);
4869 if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7proteus_15superluWrappers_cSparseMatrix))))) __PYX_ERR(0, 175, __pyx_L1_error)
4870 __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_w);
if (unlikely((__pyx_t_2 == (
double)-1) && PyErr_Occurred())) __PYX_ERR(0, 175, __pyx_L1_error)
4871 __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_v_tol);
if (unlikely((__pyx_t_3 == (
double)-1) && PyErr_Occurred())) __PYX_ERR(0, 175, __pyx_L1_error)
4872 __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_M, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 175, __pyx_L1_error)
4873 __pyx_f_10csmoothers_smootherWrappersgauss_seidel_NR_prepare(((
struct __pyx_obj_7proteus_15superluWrappers_cSparseMatrix *)__pyx_t_1), __pyx_t_2, __pyx_t_3, __pyx_t_4);
4874 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4875 __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1);
4876 __pyx_t_4.memview = NULL;
4877 __pyx_t_4.data = NULL;
4888 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4891 __Pyx_XDECREF(__pyx_t_1);
4892 __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1);
4893 __Pyx_AddTraceback(
"csmoothers.gauss_seidel_NR_preare", __pyx_clineno, __pyx_lineno, __pyx_filename);
4896 __Pyx_XGIVEREF(__pyx_r);
4897 __Pyx_RefNannyFinishContext();
4909 static void __pyx_f_10csmoothers_smootherWrappersgauss_seidel_NR_prepare(
struct __pyx_obj_7proteus_15superluWrappers_cSparseMatrix *__pyx_v_sm,
double __pyx_v_w,
double __pyx_v_tol, __pyx_t_10csmoothers_DDATA __pyx_v_M) {
4910 __pyx_t_10csmoothers_SuperMatrix __pyx_v_AS;
4911 __Pyx_RefNannyDeclarations
4912 PyObject *__pyx_t_1 = NULL;
4914 Py_ssize_t __pyx_t_3;
4915 int __pyx_lineno = 0;
4916 const char *__pyx_filename = NULL;
4917 int __pyx_clineno = 0;
4918 __Pyx_RefNannySetupContext(
"smootherWrappersgauss_seidel_NR_prepare", 0);
4927 __pyx_v_AS.Stype = SLU_NR;
4936 __pyx_v_AS.Dtype = SLU_D;
4945 __pyx_v_AS.Mtype = SLU_GE;
4954 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_sm), __pyx_n_s_nr);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 185, __pyx_L1_error)
4955 __Pyx_GOTREF(__pyx_t_1);
4956 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 185, __pyx_L1_error)
4957 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4958 __pyx_v_AS.nrow = __pyx_t_2;
4967 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_sm), __pyx_n_s_nc);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 186, __pyx_L1_error)
4968 __Pyx_GOTREF(__pyx_t_1);
4969 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 186, __pyx_L1_error)
4970 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4971 __pyx_v_AS.ncol = __pyx_t_2;
4980 __pyx_v_AS.Store = (&__pyx_v_sm->A);
4991 if (__pyx_t_3 < 0) {
4992 __pyx_t_3 += __pyx_v_M.shape[0];
4993 if (unlikely(__pyx_t_3 < 0)) __pyx_t_2 = 0;
4994 }
else if (unlikely(__pyx_t_3 >= __pyx_v_M.shape[0])) __pyx_t_2 = 0;
4995 if (unlikely(__pyx_t_2 != -1)) {
4996 __Pyx_RaiseBufferIndexError(__pyx_t_2);
4997 __PYX_ERR(0, 188, __pyx_L1_error)
4999 gauss_seidel_NR_prepare((&__pyx_v_AS), __pyx_v_w, __pyx_v_tol, (&(*((
double *) ( (__pyx_v_M.data + __pyx_t_3 * __pyx_v_M.strides[0]) )))));
5012 __Pyx_XDECREF(__pyx_t_1);
5013 __Pyx_WriteUnraisable(
"csmoothers.smootherWrappersgauss_seidel_NR_prepare", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
5015 __Pyx_RefNannyFinishContext();
5027 static PyObject *__pyx_pw_10csmoothers_9gauss_seidel_NR_solve(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
5028 static char __pyx_doc_10csmoothers_8gauss_seidel_NR_solve[] =
"\n\n Arguments\n ---------\n A : superluWrappers.SparseMatrix\n M : np.array double\n R : np.array double\n node_order : np.array int\n dX : np.array double\n ";
5029 static PyMethodDef __pyx_mdef_10csmoothers_9gauss_seidel_NR_solve = {
"gauss_seidel_NR_solve", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_10csmoothers_9gauss_seidel_NR_solve, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10csmoothers_8gauss_seidel_NR_solve};
5030 static PyObject *__pyx_pw_10csmoothers_9gauss_seidel_NR_solve(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5031 PyObject *__pyx_v_A = 0;
5032 PyObject *__pyx_v_M = 0;
5033 PyObject *__pyx_v_R = 0;
5034 PyObject *__pyx_v_node_order = 0;
5035 PyObject *__pyx_v_dX = 0;
5036 int __pyx_lineno = 0;
5037 const char *__pyx_filename = NULL;
5038 int __pyx_clineno = 0;
5039 PyObject *__pyx_r = 0;
5040 __Pyx_RefNannyDeclarations
5041 __Pyx_RefNannySetupContext(
"gauss_seidel_NR_solve (wrapper)", 0);
5043 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_A,&__pyx_n_s_M,&__pyx_n_s_R,&__pyx_n_s_node_order,&__pyx_n_s_dX,0};
5044 PyObject* values[5] = {0,0,0,0,0};
5045 if (unlikely(__pyx_kwds)) {
5047 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5049 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5051 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5053 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5055 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5057 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5060 default:
goto __pyx_L5_argtuple_error;
5062 kw_args = PyDict_Size(__pyx_kwds);
5065 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_A)) != 0)) kw_args--;
5066 else goto __pyx_L5_argtuple_error;
5069 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_M)) != 0)) kw_args--;
5071 __Pyx_RaiseArgtupleInvalid(
"gauss_seidel_NR_solve", 1, 5, 5, 1); __PYX_ERR(0, 190, __pyx_L3_error)
5075 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_R)) != 0)) kw_args--;
5077 __Pyx_RaiseArgtupleInvalid(
"gauss_seidel_NR_solve", 1, 5, 5, 2); __PYX_ERR(0, 190, __pyx_L3_error)
5081 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_node_order)) != 0)) kw_args--;
5083 __Pyx_RaiseArgtupleInvalid(
"gauss_seidel_NR_solve", 1, 5, 5, 3); __PYX_ERR(0, 190, __pyx_L3_error)
5087 if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dX)) != 0)) kw_args--;
5089 __Pyx_RaiseArgtupleInvalid(
"gauss_seidel_NR_solve", 1, 5, 5, 4); __PYX_ERR(0, 190, __pyx_L3_error)
5092 if (unlikely(kw_args > 0)) {
5093 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"gauss_seidel_NR_solve") < 0)) __PYX_ERR(0, 190, __pyx_L3_error)
5095 }
else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
5096 goto __pyx_L5_argtuple_error;
5098 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5099 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5100 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5101 values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5102 values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5104 __pyx_v_A = values[0];
5105 __pyx_v_M = values[1];
5106 __pyx_v_R = values[2];
5107 __pyx_v_node_order = values[3];
5108 __pyx_v_dX = values[4];
5110 goto __pyx_L4_argument_unpacking_done;
5111 __pyx_L5_argtuple_error:;
5112 __Pyx_RaiseArgtupleInvalid(
"gauss_seidel_NR_solve", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 190, __pyx_L3_error)
5114 __Pyx_AddTraceback(
"csmoothers.gauss_seidel_NR_solve", __pyx_clineno, __pyx_lineno, __pyx_filename);
5115 __Pyx_RefNannyFinishContext();
5117 __pyx_L4_argument_unpacking_done:;
5118 __pyx_r = __pyx_pf_10csmoothers_8gauss_seidel_NR_solve(__pyx_self, __pyx_v_A, __pyx_v_M, __pyx_v_R, __pyx_v_node_order, __pyx_v_dX);
5121 __Pyx_RefNannyFinishContext();
5125 static PyObject *__pyx_pf_10csmoothers_8gauss_seidel_NR_solve(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_M, PyObject *__pyx_v_R, PyObject *__pyx_v_node_order, PyObject *__pyx_v_dX) {
5126 PyObject *__pyx_r = NULL;
5127 __Pyx_RefNannyDeclarations
5128 PyObject *__pyx_t_1 = NULL;
5129 __pyx_t_10csmoothers_DDATA __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } };
5130 __pyx_t_10csmoothers_DDATA __pyx_t_3 = { 0, 0, { 0 }, { 0 }, { 0 } };
5131 __pyx_t_10csmoothers_IDATA __pyx_t_4 = { 0, 0, { 0 }, { 0 }, { 0 } };
5132 __pyx_t_10csmoothers_DDATA __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
5133 int __pyx_lineno = 0;
5134 const char *__pyx_filename = NULL;
5135 int __pyx_clineno = 0;
5136 __Pyx_RefNannySetupContext(
"gauss_seidel_NR_solve", 0);
5145 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_A, __pyx_n_s_cSparseMatrix);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 201, __pyx_L1_error)
5146 __Pyx_GOTREF(__pyx_t_1);
5147 if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7proteus_15superluWrappers_cSparseMatrix))))) __PYX_ERR(0, 201, __pyx_L1_error)
5148 __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_M, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 201, __pyx_L1_error)
5149 __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_R, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 201, __pyx_L1_error)
5150 __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_v_node_order, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 201, __pyx_L1_error)
5151 __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_dX, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 201, __pyx_L1_error)
5152 __pyx_f_10csmoothers_smootherWrappersgauss_seidel_NR_solve(((
struct __pyx_obj_7proteus_15superluWrappers_cSparseMatrix *)__pyx_t_1), __pyx_t_2, __pyx_t_3, __pyx_t_4, __pyx_t_5);
5153 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5154 __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1);
5155 __pyx_t_2.memview = NULL;
5156 __pyx_t_2.data = NULL;
5157 __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
5158 __pyx_t_3.memview = NULL;
5159 __pyx_t_3.data = NULL;
5160 __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1);
5161 __pyx_t_4.memview = NULL;
5162 __pyx_t_4.data = NULL;
5163 __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
5164 __pyx_t_5.memview = NULL;
5165 __pyx_t_5.data = NULL;
5176 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5179 __Pyx_XDECREF(__pyx_t_1);
5180 __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1);
5181 __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
5182 __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1);
5183 __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
5184 __Pyx_AddTraceback(
"csmoothers.gauss_seidel_NR_solve", __pyx_clineno, __pyx_lineno, __pyx_filename);
5187 __Pyx_XGIVEREF(__pyx_r);
5188 __Pyx_RefNannyFinishContext();
5200 static void __pyx_f_10csmoothers_smootherWrappersgauss_seidel_NR_solve(
struct __pyx_obj_7proteus_15superluWrappers_cSparseMatrix *__pyx_v_sm, __pyx_t_10csmoothers_DDATA __pyx_v_M, __pyx_t_10csmoothers_DDATA __pyx_v_R, __pyx_t_10csmoothers_IDATA __pyx_v_node_order, __pyx_t_10csmoothers_DDATA __pyx_v_dX) {
5201 __pyx_t_10csmoothers_SuperMatrix __pyx_v_AS;
5202 __Pyx_RefNannyDeclarations
5203 PyObject *__pyx_t_1 = NULL;
5205 Py_ssize_t __pyx_t_3;
5206 Py_ssize_t __pyx_t_4;
5207 Py_ssize_t __pyx_t_5;
5208 Py_ssize_t __pyx_t_6;
5209 int __pyx_lineno = 0;
5210 const char *__pyx_filename = NULL;
5211 int __pyx_clineno = 0;
5212 __Pyx_RefNannySetupContext(
"smootherWrappersgauss_seidel_NR_solve", 0);
5221 __pyx_v_AS.Stype = SLU_NR;
5230 __pyx_v_AS.Dtype = SLU_D;
5239 __pyx_v_AS.Mtype = SLU_GE;
5248 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_sm), __pyx_n_s_nr);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 212, __pyx_L1_error)
5249 __Pyx_GOTREF(__pyx_t_1);
5250 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 212, __pyx_L1_error)
5251 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5252 __pyx_v_AS.nrow = __pyx_t_2;
5261 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_sm), __pyx_n_s_nc);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 213, __pyx_L1_error)
5262 __Pyx_GOTREF(__pyx_t_1);
5263 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 213, __pyx_L1_error)
5264 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5265 __pyx_v_AS.ncol = __pyx_t_2;
5274 __pyx_v_AS.Store = (&__pyx_v_sm->A);
5285 if (__pyx_t_3 < 0) {
5286 __pyx_t_3 += __pyx_v_M.shape[0];
5287 if (unlikely(__pyx_t_3 < 0)) __pyx_t_2 = 0;
5288 }
else if (unlikely(__pyx_t_3 >= __pyx_v_M.shape[0])) __pyx_t_2 = 0;
5289 if (unlikely(__pyx_t_2 != -1)) {
5290 __Pyx_RaiseBufferIndexError(__pyx_t_2);
5291 __PYX_ERR(0, 215, __pyx_L1_error)
5295 if (__pyx_t_4 < 0) {
5296 __pyx_t_4 += __pyx_v_R.shape[0];
5297 if (unlikely(__pyx_t_4 < 0)) __pyx_t_2 = 0;
5298 }
else if (unlikely(__pyx_t_4 >= __pyx_v_R.shape[0])) __pyx_t_2 = 0;
5299 if (unlikely(__pyx_t_2 != -1)) {
5300 __Pyx_RaiseBufferIndexError(__pyx_t_2);
5301 __PYX_ERR(0, 215, __pyx_L1_error)
5305 if (__pyx_t_5 < 0) {
5306 __pyx_t_5 += __pyx_v_node_order.shape[0];
5307 if (unlikely(__pyx_t_5 < 0)) __pyx_t_2 = 0;
5308 }
else if (unlikely(__pyx_t_5 >= __pyx_v_node_order.shape[0])) __pyx_t_2 = 0;
5309 if (unlikely(__pyx_t_2 != -1)) {
5310 __Pyx_RaiseBufferIndexError(__pyx_t_2);
5311 __PYX_ERR(0, 215, __pyx_L1_error)
5315 if (__pyx_t_6 < 0) {
5316 __pyx_t_6 += __pyx_v_dX.shape[0];
5317 if (unlikely(__pyx_t_6 < 0)) __pyx_t_2 = 0;
5318 }
else if (unlikely(__pyx_t_6 >= __pyx_v_dX.shape[0])) __pyx_t_2 = 0;
5319 if (unlikely(__pyx_t_2 != -1)) {
5320 __Pyx_RaiseBufferIndexError(__pyx_t_2);
5321 __PYX_ERR(0, 215, __pyx_L1_error)
5323 gauss_seidel_NR_solve((&__pyx_v_AS), (&(*((
double *) ( (__pyx_v_M.data + __pyx_t_3 * __pyx_v_M.strides[0]) )))), (&(*((
double *) ( (__pyx_v_R.data + __pyx_t_4 * __pyx_v_R.strides[0]) )))), (&(*((
int *) ( (__pyx_v_node_order.data + __pyx_t_5 * __pyx_v_node_order.strides[0]) )))), (&(*((
double *) ( (__pyx_v_dX.data + __pyx_t_6 * __pyx_v_dX.strides[0]) )))));
5336 __Pyx_XDECREF(__pyx_t_1);
5337 __Pyx_WriteUnraisable(
"csmoothers.smootherWrappersgauss_seidel_NR_solve", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
5339 __Pyx_RefNannyFinishContext();
5351 static PyObject *__pyx_pw_10csmoothers_11nl_gauss_seidel_NR_solve(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
5352 static char __pyx_doc_10csmoothers_10nl_gauss_seidel_NR_solve[] =
"\n \n Arguments\n ---------\n A : superluWrappers.SparseMatrix\n R : np.array double\n node_order : np.array int\n w : double\n tol : double\n dX : np.array double\n ";
5353 static PyMethodDef __pyx_mdef_10csmoothers_11nl_gauss_seidel_NR_solve = {
"nl_gauss_seidel_NR_solve", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_10csmoothers_11nl_gauss_seidel_NR_solve, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10csmoothers_10nl_gauss_seidel_NR_solve};
5354 static PyObject *__pyx_pw_10csmoothers_11nl_gauss_seidel_NR_solve(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5355 PyObject *__pyx_v_A = 0;
5356 PyObject *__pyx_v_R = 0;
5357 PyObject *__pyx_v_node_order = 0;
5358 PyObject *__pyx_v_w = 0;
5359 PyObject *__pyx_v_tol = 0;
5360 PyObject *__pyx_v_dX = 0;
5361 int __pyx_lineno = 0;
5362 const char *__pyx_filename = NULL;
5363 int __pyx_clineno = 0;
5364 PyObject *__pyx_r = 0;
5365 __Pyx_RefNannyDeclarations
5366 __Pyx_RefNannySetupContext(
"nl_gauss_seidel_NR_solve (wrapper)", 0);
5368 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_A,&__pyx_n_s_R,&__pyx_n_s_node_order,&__pyx_n_s_w,&__pyx_n_s_tol,&__pyx_n_s_dX,0};
5369 PyObject* values[6] = {0,0,0,0,0,0};
5370 if (unlikely(__pyx_kwds)) {
5372 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5374 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
5376 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5378 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5380 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5382 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5384 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5387 default:
goto __pyx_L5_argtuple_error;
5389 kw_args = PyDict_Size(__pyx_kwds);
5392 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_A)) != 0)) kw_args--;
5393 else goto __pyx_L5_argtuple_error;
5396 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_R)) != 0)) kw_args--;
5398 __Pyx_RaiseArgtupleInvalid(
"nl_gauss_seidel_NR_solve", 1, 6, 6, 1); __PYX_ERR(0, 217, __pyx_L3_error)
5402 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_node_order)) != 0)) kw_args--;
5404 __Pyx_RaiseArgtupleInvalid(
"nl_gauss_seidel_NR_solve", 1, 6, 6, 2); __PYX_ERR(0, 217, __pyx_L3_error)
5408 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
5410 __Pyx_RaiseArgtupleInvalid(
"nl_gauss_seidel_NR_solve", 1, 6, 6, 3); __PYX_ERR(0, 217, __pyx_L3_error)
5414 if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_tol)) != 0)) kw_args--;
5416 __Pyx_RaiseArgtupleInvalid(
"nl_gauss_seidel_NR_solve", 1, 6, 6, 4); __PYX_ERR(0, 217, __pyx_L3_error)
5420 if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dX)) != 0)) kw_args--;
5422 __Pyx_RaiseArgtupleInvalid(
"nl_gauss_seidel_NR_solve", 1, 6, 6, 5); __PYX_ERR(0, 217, __pyx_L3_error)
5425 if (unlikely(kw_args > 0)) {
5426 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"nl_gauss_seidel_NR_solve") < 0)) __PYX_ERR(0, 217, __pyx_L3_error)
5428 }
else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
5429 goto __pyx_L5_argtuple_error;
5431 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5432 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5433 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5434 values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5435 values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5436 values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
5438 __pyx_v_A = values[0];
5439 __pyx_v_R = values[1];
5440 __pyx_v_node_order = values[2];
5441 __pyx_v_w = values[3];
5442 __pyx_v_tol = values[4];
5443 __pyx_v_dX = values[5];
5445 goto __pyx_L4_argument_unpacking_done;
5446 __pyx_L5_argtuple_error:;
5447 __Pyx_RaiseArgtupleInvalid(
"nl_gauss_seidel_NR_solve", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 217, __pyx_L3_error)
5449 __Pyx_AddTraceback(
"csmoothers.nl_gauss_seidel_NR_solve", __pyx_clineno, __pyx_lineno, __pyx_filename);
5450 __Pyx_RefNannyFinishContext();
5452 __pyx_L4_argument_unpacking_done:;
5453 __pyx_r = __pyx_pf_10csmoothers_10nl_gauss_seidel_NR_solve(__pyx_self, __pyx_v_A, __pyx_v_R, __pyx_v_node_order, __pyx_v_w, __pyx_v_tol, __pyx_v_dX);
5456 __Pyx_RefNannyFinishContext();
5460 static PyObject *__pyx_pf_10csmoothers_10nl_gauss_seidel_NR_solve(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_R, PyObject *__pyx_v_node_order, PyObject *__pyx_v_w, PyObject *__pyx_v_tol, PyObject *__pyx_v_dX) {
5461 PyObject *__pyx_r = NULL;
5462 __Pyx_RefNannyDeclarations
5463 PyObject *__pyx_t_1 = NULL;
5464 __pyx_t_10csmoothers_DDATA __pyx_t_2 = { 0, 0, { 0 }, { 0 }, { 0 } };
5465 __pyx_t_10csmoothers_IDATA __pyx_t_3 = { 0, 0, { 0 }, { 0 }, { 0 } };
5468 __pyx_t_10csmoothers_DDATA __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
5469 PyObject *__pyx_t_7 = NULL;
5470 int __pyx_lineno = 0;
5471 const char *__pyx_filename = NULL;
5472 int __pyx_clineno = 0;
5473 __Pyx_RefNannySetupContext(
"nl_gauss_seidel_NR_solve", 0);
5482 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_A, __pyx_n_s_cSparseMatrix);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 229, __pyx_L1_error)
5483 __Pyx_GOTREF(__pyx_t_1);
5484 if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7proteus_15superluWrappers_cSparseMatrix))))) __PYX_ERR(0, 229, __pyx_L1_error)
5493 __pyx_t_2 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_R, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_2.memview)) __PYX_ERR(0, 230, __pyx_L1_error)
5502 __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_v_node_order, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(0, 231, __pyx_L1_error)
5511 __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_w);
if (unlikely((__pyx_t_4 == (
double)-1) && PyErr_Occurred())) __PYX_ERR(0, 232, __pyx_L1_error)
5520 __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_tol);
if (unlikely((__pyx_t_5 == (
double)-1) && PyErr_Occurred())) __PYX_ERR(0, 233, __pyx_L1_error)
5529 __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_dX, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 234, __pyx_L1_error)
5538 __pyx_t_7 = __pyx_f_10csmoothers_smootherWrappers_nl_gauss_seidel_NR_solve(((
struct __pyx_obj_7proteus_15superluWrappers_cSparseMatrix *)__pyx_t_1), __pyx_t_2, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6);
if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 229, __pyx_L1_error)
5539 __Pyx_GOTREF(__pyx_t_7);
5540 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5541 __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1);
5542 __pyx_t_2.memview = NULL;
5543 __pyx_t_2.data = NULL;
5544 __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
5545 __pyx_t_3.memview = NULL;
5546 __pyx_t_3.data = NULL;
5547 __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
5548 __pyx_t_6.memview = NULL;
5549 __pyx_t_6.data = NULL;
5550 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
5561 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5564 __Pyx_XDECREF(__pyx_t_1);
5565 __PYX_XDEC_MEMVIEW(&__pyx_t_2, 1);
5566 __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1);
5567 __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
5568 __Pyx_XDECREF(__pyx_t_7);
5569 __Pyx_AddTraceback(
"csmoothers.nl_gauss_seidel_NR_solve", __pyx_clineno, __pyx_lineno, __pyx_filename);
5572 __Pyx_XGIVEREF(__pyx_r);
5573 __Pyx_RefNannyFinishContext();
5585 static PyObject *__pyx_f_10csmoothers_smootherWrappers_nl_gauss_seidel_NR_solve(
struct __pyx_obj_7proteus_15superluWrappers_cSparseMatrix *__pyx_v_sm, __pyx_t_10csmoothers_DDATA __pyx_v_R, __pyx_t_10csmoothers_IDATA __pyx_v_node_order,
double __pyx_v_w,
double __pyx_v_tol, __pyx_t_10csmoothers_DDATA __pyx_v_dX) {
5586 __pyx_t_10csmoothers_SuperMatrix __pyx_v_AS;
5587 PyObject *__pyx_r = NULL;
5588 __Pyx_RefNannyDeclarations
5589 PyObject *__pyx_t_1 = NULL;
5591 Py_ssize_t __pyx_t_3;
5592 Py_ssize_t __pyx_t_4;
5593 Py_ssize_t __pyx_t_5;
5594 int __pyx_lineno = 0;
5595 const char *__pyx_filename = NULL;
5596 int __pyx_clineno = 0;
5597 __Pyx_RefNannySetupContext(
"smootherWrappers_nl_gauss_seidel_NR_solve", 0);
5606 __pyx_v_AS.Stype = SLU_NR;
5615 __pyx_v_AS.Dtype = SLU_D;
5624 __pyx_v_AS.Mtype = SLU_GE;
5633 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_sm), __pyx_n_s_nr);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 246, __pyx_L1_error)
5634 __Pyx_GOTREF(__pyx_t_1);
5635 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 246, __pyx_L1_error)
5636 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5637 __pyx_v_AS.nrow = __pyx_t_2;
5646 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_sm), __pyx_n_s_nc);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 247, __pyx_L1_error)
5647 __Pyx_GOTREF(__pyx_t_1);
5648 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 247, __pyx_L1_error)
5649 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5650 __pyx_v_AS.ncol = __pyx_t_2;
5659 __pyx_v_AS.Store = (&__pyx_v_sm->A);
5670 if (__pyx_t_3 < 0) {
5671 __pyx_t_3 += __pyx_v_R.shape[0];
5672 if (unlikely(__pyx_t_3 < 0)) __pyx_t_2 = 0;
5673 }
else if (unlikely(__pyx_t_3 >= __pyx_v_R.shape[0])) __pyx_t_2 = 0;
5674 if (unlikely(__pyx_t_2 != -1)) {
5675 __Pyx_RaiseBufferIndexError(__pyx_t_2);
5676 __PYX_ERR(0, 249, __pyx_L1_error)
5680 if (__pyx_t_4 < 0) {
5681 __pyx_t_4 += __pyx_v_node_order.shape[0];
5682 if (unlikely(__pyx_t_4 < 0)) __pyx_t_2 = 0;
5683 }
else if (unlikely(__pyx_t_4 >= __pyx_v_node_order.shape[0])) __pyx_t_2 = 0;
5684 if (unlikely(__pyx_t_2 != -1)) {
5685 __Pyx_RaiseBufferIndexError(__pyx_t_2);
5686 __PYX_ERR(0, 249, __pyx_L1_error)
5690 if (__pyx_t_5 < 0) {
5691 __pyx_t_5 += __pyx_v_dX.shape[0];
5692 if (unlikely(__pyx_t_5 < 0)) __pyx_t_2 = 0;
5693 }
else if (unlikely(__pyx_t_5 >= __pyx_v_dX.shape[0])) __pyx_t_2 = 0;
5694 if (unlikely(__pyx_t_2 != -1)) {
5695 __Pyx_RaiseBufferIndexError(__pyx_t_2);
5696 __PYX_ERR(0, 249, __pyx_L1_error)
5698 nl_gauss_seidel_NR_solve((&__pyx_v_AS), (&(*((
double *) ( (__pyx_v_R.data + __pyx_t_3 * __pyx_v_R.strides[0]) )))), (&(*((
int *) ( (__pyx_v_node_order.data + __pyx_t_4 * __pyx_v_node_order.strides[0]) )))), __pyx_v_w, __pyx_v_tol, (&(*((
double *) ( (__pyx_v_dX.data + __pyx_t_5 * __pyx_v_dX.strides[0]) )))));
5709 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5712 __Pyx_XDECREF(__pyx_t_1);
5713 __Pyx_AddTraceback(
"csmoothers.smootherWrappers_nl_gauss_seidel_NR_solve", __pyx_clineno, __pyx_lineno, __pyx_filename);
5716 __Pyx_XGIVEREF(__pyx_r);
5717 __Pyx_RefNannyFinishContext();
5730 static PyObject *__pyx_pw_10csmoothers_13asm_NR_prepare(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
5731 static char __pyx_doc_10csmoothers_12asm_NR_prepare[] =
"\n\n Arguments\n ---------\n A :\n asmFactor :\n ";
5732 static PyMethodDef __pyx_mdef_10csmoothers_13asm_NR_prepare = {
"asm_NR_prepare", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_10csmoothers_13asm_NR_prepare, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10csmoothers_12asm_NR_prepare};
5733 static PyObject *__pyx_pw_10csmoothers_13asm_NR_prepare(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5734 PyObject *__pyx_v_A = 0;
5735 PyObject *__pyx_v_asmFactor = 0;
5736 int __pyx_lineno = 0;
5737 const char *__pyx_filename = NULL;
5738 int __pyx_clineno = 0;
5739 PyObject *__pyx_r = 0;
5740 __Pyx_RefNannyDeclarations
5741 __Pyx_RefNannySetupContext(
"asm_NR_prepare (wrapper)", 0);
5743 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_A,&__pyx_n_s_asmFactor,0};
5744 PyObject* values[2] = {0,0};
5745 if (unlikely(__pyx_kwds)) {
5747 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5749 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5751 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5754 default:
goto __pyx_L5_argtuple_error;
5756 kw_args = PyDict_Size(__pyx_kwds);
5759 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_A)) != 0)) kw_args--;
5760 else goto __pyx_L5_argtuple_error;
5763 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_asmFactor)) != 0)) kw_args--;
5765 __Pyx_RaiseArgtupleInvalid(
"asm_NR_prepare", 1, 2, 2, 1); __PYX_ERR(0, 251, __pyx_L3_error)
5768 if (unlikely(kw_args > 0)) {
5769 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"asm_NR_prepare") < 0)) __PYX_ERR(0, 251, __pyx_L3_error)
5771 }
else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
5772 goto __pyx_L5_argtuple_error;
5774 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5775 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5777 __pyx_v_A = values[0];
5778 __pyx_v_asmFactor = values[1];
5780 goto __pyx_L4_argument_unpacking_done;
5781 __pyx_L5_argtuple_error:;
5782 __Pyx_RaiseArgtupleInvalid(
"asm_NR_prepare", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 251, __pyx_L3_error)
5784 __Pyx_AddTraceback(
"csmoothers.asm_NR_prepare", __pyx_clineno, __pyx_lineno, __pyx_filename);
5785 __Pyx_RefNannyFinishContext();
5787 __pyx_L4_argument_unpacking_done:;
5788 __pyx_r = __pyx_pf_10csmoothers_12asm_NR_prepare(__pyx_self, __pyx_v_A, __pyx_v_asmFactor);
5791 __Pyx_RefNannyFinishContext();
5795 static PyObject *__pyx_pf_10csmoothers_12asm_NR_prepare(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_asmFactor) {
5796 PyObject *__pyx_r = NULL;
5797 __Pyx_RefNannyDeclarations
5798 PyObject *__pyx_t_1 = NULL;
5799 PyObject *__pyx_t_2 = NULL;
5800 int __pyx_lineno = 0;
5801 const char *__pyx_filename = NULL;
5802 int __pyx_clineno = 0;
5803 __Pyx_RefNannySetupContext(
"asm_NR_prepare", 0);
5812 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_A, __pyx_n_s_cSparseMatrix);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 259, __pyx_L1_error)
5813 __Pyx_GOTREF(__pyx_t_1);
5814 if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7proteus_15superluWrappers_cSparseMatrix))))) __PYX_ERR(0, 259, __pyx_L1_error)
5823 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_asmFactor, __pyx_n_s_cASMFactor);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 260, __pyx_L1_error)
5824 __Pyx_GOTREF(__pyx_t_2);
5825 if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_10csmoothers_cASMFactor))))) __PYX_ERR(0, 260, __pyx_L1_error)
5834 __pyx_f_10csmoothers_smootherWrappers_asm_NR_prepare(((
struct __pyx_obj_7proteus_15superluWrappers_cSparseMatrix *)__pyx_t_1), ((
struct __pyx_obj_10csmoothers_cASMFactor *)__pyx_t_2));
5835 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5836 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5847 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5850 __Pyx_XDECREF(__pyx_t_1);
5851 __Pyx_XDECREF(__pyx_t_2);
5852 __Pyx_AddTraceback(
"csmoothers.asm_NR_prepare", __pyx_clineno, __pyx_lineno, __pyx_filename);
5855 __Pyx_XGIVEREF(__pyx_r);
5856 __Pyx_RefNannyFinishContext();
5868 static void __pyx_f_10csmoothers_smootherWrappers_asm_NR_prepare(
struct __pyx_obj_7proteus_15superluWrappers_cSparseMatrix *__pyx_v_sm,
struct __pyx_obj_10csmoothers_cASMFactor *__pyx_v_asmFactor) {
5869 __pyx_t_10csmoothers_SuperMatrix __pyx_v_AS;
5870 __Pyx_RefNannyDeclarations
5871 PyObject *__pyx_t_1 = NULL;
5873 int __pyx_lineno = 0;
5874 const char *__pyx_filename = NULL;
5875 int __pyx_clineno = 0;
5876 __Pyx_RefNannySetupContext(
"smootherWrappers_asm_NR_prepare", 0);
5885 __pyx_v_AS.Stype = SLU_NR;
5894 __pyx_v_AS.Dtype = SLU_D;
5903 __pyx_v_AS.Mtype = SLU_GE;
5912 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_sm), __pyx_n_s_nr);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 268, __pyx_L1_error)
5913 __Pyx_GOTREF(__pyx_t_1);
5914 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 268, __pyx_L1_error)
5915 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5916 __pyx_v_AS.nrow = __pyx_t_2;
5925 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_sm), __pyx_n_s_nc);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 269, __pyx_L1_error)
5926 __Pyx_GOTREF(__pyx_t_1);
5927 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 269, __pyx_L1_error)
5928 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5929 __pyx_v_AS.ncol = __pyx_t_2;
5938 __pyx_v_AS.Store = (&__pyx_v_sm->A);
5947 asm_NR_prepare((&__pyx_v_AS), __pyx_v_asmFactor->subdomain_dim, __pyx_v_asmFactor->l2g_L, __pyx_v_asmFactor->subdomain_L, __pyx_v_asmFactor->subdomain_pivots);
5960 __Pyx_XDECREF(__pyx_t_1);
5961 __Pyx_WriteUnraisable(
"csmoothers.smootherWrappers_asm_NR_prepare", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
5963 __Pyx_RefNannyFinishContext();
5975 static PyObject *__pyx_pw_10csmoothers_15asm_NR_solve(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
5976 static char __pyx_doc_10csmoothers_14asm_NR_solve[] =
"\n \n Arguments\n ---------\n A : superluWrappers.sparseMatrix\n w : double\n asmFactor : csmoothers.asmFactor\n node_order : np.array int\n R : np.array double\n dX : np.array double\n ";
5977 static PyMethodDef __pyx_mdef_10csmoothers_15asm_NR_solve = {
"asm_NR_solve", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_10csmoothers_15asm_NR_solve, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10csmoothers_14asm_NR_solve};
5978 static PyObject *__pyx_pw_10csmoothers_15asm_NR_solve(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5979 PyObject *__pyx_v_A = 0;
5980 PyObject *__pyx_v_w = 0;
5981 PyObject *__pyx_v_asmFactor = 0;
5982 PyObject *__pyx_v_node_order = 0;
5983 PyObject *__pyx_v_R = 0;
5984 PyObject *__pyx_v_dX = 0;
5985 int __pyx_lineno = 0;
5986 const char *__pyx_filename = NULL;
5987 int __pyx_clineno = 0;
5988 PyObject *__pyx_r = 0;
5989 __Pyx_RefNannyDeclarations
5990 __Pyx_RefNannySetupContext(
"asm_NR_solve (wrapper)", 0);
5992 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_A,&__pyx_n_s_w,&__pyx_n_s_asmFactor,&__pyx_n_s_node_order,&__pyx_n_s_R,&__pyx_n_s_dX,0};
5993 PyObject* values[6] = {0,0,0,0,0,0};
5994 if (unlikely(__pyx_kwds)) {
5996 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5998 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
6000 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6002 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6004 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6006 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6008 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6011 default:
goto __pyx_L5_argtuple_error;
6013 kw_args = PyDict_Size(__pyx_kwds);
6016 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_A)) != 0)) kw_args--;
6017 else goto __pyx_L5_argtuple_error;
6020 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
6022 __Pyx_RaiseArgtupleInvalid(
"asm_NR_solve", 1, 6, 6, 1); __PYX_ERR(0, 277, __pyx_L3_error)
6026 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_asmFactor)) != 0)) kw_args--;
6028 __Pyx_RaiseArgtupleInvalid(
"asm_NR_solve", 1, 6, 6, 2); __PYX_ERR(0, 277, __pyx_L3_error)
6032 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_node_order)) != 0)) kw_args--;
6034 __Pyx_RaiseArgtupleInvalid(
"asm_NR_solve", 1, 6, 6, 3); __PYX_ERR(0, 277, __pyx_L3_error)
6038 if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_R)) != 0)) kw_args--;
6040 __Pyx_RaiseArgtupleInvalid(
"asm_NR_solve", 1, 6, 6, 4); __PYX_ERR(0, 277, __pyx_L3_error)
6044 if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dX)) != 0)) kw_args--;
6046 __Pyx_RaiseArgtupleInvalid(
"asm_NR_solve", 1, 6, 6, 5); __PYX_ERR(0, 277, __pyx_L3_error)
6049 if (unlikely(kw_args > 0)) {
6050 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"asm_NR_solve") < 0)) __PYX_ERR(0, 277, __pyx_L3_error)
6052 }
else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
6053 goto __pyx_L5_argtuple_error;
6055 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6056 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6057 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6058 values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6059 values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6060 values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
6062 __pyx_v_A = values[0];
6063 __pyx_v_w = values[1];
6064 __pyx_v_asmFactor = values[2];
6065 __pyx_v_node_order = values[3];
6066 __pyx_v_R = values[4];
6067 __pyx_v_dX = values[5];
6069 goto __pyx_L4_argument_unpacking_done;
6070 __pyx_L5_argtuple_error:;
6071 __Pyx_RaiseArgtupleInvalid(
"asm_NR_solve", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 277, __pyx_L3_error)
6073 __Pyx_AddTraceback(
"csmoothers.asm_NR_solve", __pyx_clineno, __pyx_lineno, __pyx_filename);
6074 __Pyx_RefNannyFinishContext();
6076 __pyx_L4_argument_unpacking_done:;
6077 __pyx_r = __pyx_pf_10csmoothers_14asm_NR_solve(__pyx_self, __pyx_v_A, __pyx_v_w, __pyx_v_asmFactor, __pyx_v_node_order, __pyx_v_R, __pyx_v_dX);
6080 __Pyx_RefNannyFinishContext();
6084 static PyObject *__pyx_pf_10csmoothers_14asm_NR_solve(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_w, PyObject *__pyx_v_asmFactor, PyObject *__pyx_v_node_order, PyObject *__pyx_v_R, PyObject *__pyx_v_dX) {
6085 PyObject *__pyx_r = NULL;
6086 __Pyx_RefNannyDeclarations
6087 PyObject *__pyx_t_1 = NULL;
6089 PyObject *__pyx_t_3 = NULL;
6090 __pyx_t_10csmoothers_IDATA __pyx_t_4 = { 0, 0, { 0 }, { 0 }, { 0 } };
6091 __pyx_t_10csmoothers_DDATA __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
6092 __pyx_t_10csmoothers_DDATA __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
6093 int __pyx_lineno = 0;
6094 const char *__pyx_filename = NULL;
6095 int __pyx_clineno = 0;
6096 __Pyx_RefNannySetupContext(
"asm_NR_solve", 0);
6105 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_A, __pyx_n_s_cSparseMatrix);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 289, __pyx_L1_error)
6106 __Pyx_GOTREF(__pyx_t_1);
6107 if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7proteus_15superluWrappers_cSparseMatrix))))) __PYX_ERR(0, 289, __pyx_L1_error)
6116 __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_w);
if (unlikely((__pyx_t_2 == (
double)-1) && PyErr_Occurred())) __PYX_ERR(0, 290, __pyx_L1_error)
6125 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_asmFactor, __pyx_n_s_cASMFactor);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 291, __pyx_L1_error)
6126 __Pyx_GOTREF(__pyx_t_3);
6127 if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_10csmoothers_cASMFactor))))) __PYX_ERR(0, 291, __pyx_L1_error)
6136 __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_v_node_order, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 292, __pyx_L1_error)
6145 __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_R, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 293, __pyx_L1_error)
6154 __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_dX, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 294, __pyx_L1_error)
6163 __pyx_f_10csmoothers_smootherWrappers_asm_NR_solve(((
struct __pyx_obj_7proteus_15superluWrappers_cSparseMatrix *)__pyx_t_1), __pyx_t_2, ((
struct __pyx_obj_10csmoothers_cASMFactor *)__pyx_t_3), __pyx_t_4, __pyx_t_5, __pyx_t_6);
6164 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6165 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6166 __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1);
6167 __pyx_t_4.memview = NULL;
6168 __pyx_t_4.data = NULL;
6169 __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
6170 __pyx_t_5.memview = NULL;
6171 __pyx_t_5.data = NULL;
6172 __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
6173 __pyx_t_6.memview = NULL;
6174 __pyx_t_6.data = NULL;
6185 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6188 __Pyx_XDECREF(__pyx_t_1);
6189 __Pyx_XDECREF(__pyx_t_3);
6190 __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1);
6191 __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
6192 __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
6193 __Pyx_AddTraceback(
"csmoothers.asm_NR_solve", __pyx_clineno, __pyx_lineno, __pyx_filename);
6196 __Pyx_XGIVEREF(__pyx_r);
6197 __Pyx_RefNannyFinishContext();
6209 static void __pyx_f_10csmoothers_smootherWrappers_asm_NR_solve(
struct __pyx_obj_7proteus_15superluWrappers_cSparseMatrix *__pyx_v_sm,
double __pyx_v_w,
struct __pyx_obj_10csmoothers_cASMFactor *__pyx_v_asmFactor, __pyx_t_10csmoothers_IDATA __pyx_v_node_order, __pyx_t_10csmoothers_DDATA __pyx_v_R, __pyx_t_10csmoothers_DDATA __pyx_v_dX) {
6210 __pyx_t_10csmoothers_SuperMatrix __pyx_v_AS;
6211 __Pyx_RefNannyDeclarations
6212 PyObject *__pyx_t_1 = NULL;
6214 Py_ssize_t __pyx_t_3;
6215 Py_ssize_t __pyx_t_4;
6216 Py_ssize_t __pyx_t_5;
6217 int __pyx_lineno = 0;
6218 const char *__pyx_filename = NULL;
6219 int __pyx_clineno = 0;
6220 __Pyx_RefNannySetupContext(
"smootherWrappers_asm_NR_solve", 0);
6229 __pyx_v_AS.Stype = SLU_NR;
6238 __pyx_v_AS.Dtype = SLU_D;
6247 __pyx_v_AS.Mtype = SLU_GE;
6256 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_sm), __pyx_n_s_nr);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 306, __pyx_L1_error)
6257 __Pyx_GOTREF(__pyx_t_1);
6258 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 306, __pyx_L1_error)
6259 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6260 __pyx_v_AS.nrow = __pyx_t_2;
6269 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_sm), __pyx_n_s_nc);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 307, __pyx_L1_error)
6270 __Pyx_GOTREF(__pyx_t_1);
6271 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 307, __pyx_L1_error)
6272 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6273 __pyx_v_AS.ncol = __pyx_t_2;
6282 __pyx_v_AS.Store = (&__pyx_v_sm->A);
6293 if (__pyx_t_3 < 0) {
6294 __pyx_t_3 += __pyx_v_R.shape[0];
6295 if (unlikely(__pyx_t_3 < 0)) __pyx_t_2 = 0;
6296 }
else if (unlikely(__pyx_t_3 >= __pyx_v_R.shape[0])) __pyx_t_2 = 0;
6297 if (unlikely(__pyx_t_2 != -1)) {
6298 __Pyx_RaiseBufferIndexError(__pyx_t_2);
6299 __PYX_ERR(0, 314, __pyx_L1_error)
6311 if (__pyx_t_4 < 0) {
6312 __pyx_t_4 += __pyx_v_node_order.shape[0];
6313 if (unlikely(__pyx_t_4 < 0)) __pyx_t_2 = 0;
6314 }
else if (unlikely(__pyx_t_4 >= __pyx_v_node_order.shape[0])) __pyx_t_2 = 0;
6315 if (unlikely(__pyx_t_2 != -1)) {
6316 __Pyx_RaiseBufferIndexError(__pyx_t_2);
6317 __PYX_ERR(0, 316, __pyx_L1_error)
6329 if (__pyx_t_5 < 0) {
6330 __pyx_t_5 += __pyx_v_dX.shape[0];
6331 if (unlikely(__pyx_t_5 < 0)) __pyx_t_2 = 0;
6332 }
else if (unlikely(__pyx_t_5 >= __pyx_v_dX.shape[0])) __pyx_t_2 = 0;
6333 if (unlikely(__pyx_t_2 != -1)) {
6334 __Pyx_RaiseBufferIndexError(__pyx_t_2);
6335 __PYX_ERR(0, 318, __pyx_L1_error)
6345 asm_NR_solve((&__pyx_v_AS), __pyx_v_w, __pyx_v_asmFactor->subdomain_L, __pyx_v_asmFactor->subdomain_dim, __pyx_v_asmFactor->l2g_L, (&(*((
double *) ( (__pyx_v_R.data + __pyx_t_3 * __pyx_v_R.strides[0]) )))), __pyx_v_asmFactor->subdomain_R, (&(*((
int *) ( (__pyx_v_node_order.data + __pyx_t_4 * __pyx_v_node_order.strides[0]) )))), __pyx_v_asmFactor->subdomain_dX, (&(*((
double *) ( (__pyx_v_dX.data + __pyx_t_5 * __pyx_v_dX.strides[0]) )))), __pyx_v_asmFactor->subdomain_pivots);
6358 __Pyx_XDECREF(__pyx_t_1);
6359 __Pyx_WriteUnraisable(
"csmoothers.smootherWrappers_asm_NR_solve", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
6361 __Pyx_RefNannyFinishContext();
6373 static PyObject *__pyx_pw_10csmoothers_17basm_NR_prepare(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
6374 static char __pyx_doc_10csmoothers_16basm_NR_prepare[] =
"\n\n Arguments\n ---------\n A :\n basmFactor :\n ";
6375 static PyMethodDef __pyx_mdef_10csmoothers_17basm_NR_prepare = {
"basm_NR_prepare", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_10csmoothers_17basm_NR_prepare, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10csmoothers_16basm_NR_prepare};
6376 static PyObject *__pyx_pw_10csmoothers_17basm_NR_prepare(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6377 PyObject *__pyx_v_A = 0;
6378 PyObject *__pyx_v_basmFactor = 0;
6379 int __pyx_lineno = 0;
6380 const char *__pyx_filename = NULL;
6381 int __pyx_clineno = 0;
6382 PyObject *__pyx_r = 0;
6383 __Pyx_RefNannyDeclarations
6384 __Pyx_RefNannySetupContext(
"basm_NR_prepare (wrapper)", 0);
6386 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_A,&__pyx_n_s_basmFactor,0};
6387 PyObject* values[2] = {0,0};
6388 if (unlikely(__pyx_kwds)) {
6390 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6392 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6394 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6397 default:
goto __pyx_L5_argtuple_error;
6399 kw_args = PyDict_Size(__pyx_kwds);
6402 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_A)) != 0)) kw_args--;
6403 else goto __pyx_L5_argtuple_error;
6406 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_basmFactor)) != 0)) kw_args--;
6408 __Pyx_RaiseArgtupleInvalid(
"basm_NR_prepare", 1, 2, 2, 1); __PYX_ERR(0, 321, __pyx_L3_error)
6411 if (unlikely(kw_args > 0)) {
6412 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"basm_NR_prepare") < 0)) __PYX_ERR(0, 321, __pyx_L3_error)
6414 }
else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
6415 goto __pyx_L5_argtuple_error;
6417 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6418 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6420 __pyx_v_A = values[0];
6421 __pyx_v_basmFactor = values[1];
6423 goto __pyx_L4_argument_unpacking_done;
6424 __pyx_L5_argtuple_error:;
6425 __Pyx_RaiseArgtupleInvalid(
"basm_NR_prepare", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 321, __pyx_L3_error)
6427 __Pyx_AddTraceback(
"csmoothers.basm_NR_prepare", __pyx_clineno, __pyx_lineno, __pyx_filename);
6428 __Pyx_RefNannyFinishContext();
6430 __pyx_L4_argument_unpacking_done:;
6431 __pyx_r = __pyx_pf_10csmoothers_16basm_NR_prepare(__pyx_self, __pyx_v_A, __pyx_v_basmFactor);
6434 __Pyx_RefNannyFinishContext();
6438 static PyObject *__pyx_pf_10csmoothers_16basm_NR_prepare(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_basmFactor) {
6439 PyObject *__pyx_r = NULL;
6440 __Pyx_RefNannyDeclarations
6441 PyObject *__pyx_t_1 = NULL;
6442 PyObject *__pyx_t_2 = NULL;
6443 int __pyx_lineno = 0;
6444 const char *__pyx_filename = NULL;
6445 int __pyx_clineno = 0;
6446 __Pyx_RefNannySetupContext(
"basm_NR_prepare", 0);
6455 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_A, __pyx_n_s_cSparseMatrix);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 329, __pyx_L1_error)
6456 __Pyx_GOTREF(__pyx_t_1);
6457 if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7proteus_15superluWrappers_cSparseMatrix))))) __PYX_ERR(0, 329, __pyx_L1_error)
6466 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_basmFactor, __pyx_n_s_cBASMFactor);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 330, __pyx_L1_error)
6467 __Pyx_GOTREF(__pyx_t_2);
6468 if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_10csmoothers_cBASMFactor))))) __PYX_ERR(0, 330, __pyx_L1_error)
6477 __pyx_f_10csmoothers_smootherWrappers_basm_NR_prepare(((
struct __pyx_obj_7proteus_15superluWrappers_cSparseMatrix *)__pyx_t_1), ((
struct __pyx_obj_10csmoothers_cBASMFactor *)__pyx_t_2));
6478 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6479 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6490 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6493 __Pyx_XDECREF(__pyx_t_1);
6494 __Pyx_XDECREF(__pyx_t_2);
6495 __Pyx_AddTraceback(
"csmoothers.basm_NR_prepare", __pyx_clineno, __pyx_lineno, __pyx_filename);
6498 __Pyx_XGIVEREF(__pyx_r);
6499 __Pyx_RefNannyFinishContext();
6511 static void __pyx_f_10csmoothers_smootherWrappers_basm_NR_prepare(
struct __pyx_obj_7proteus_15superluWrappers_cSparseMatrix *__pyx_v_sm,
struct __pyx_obj_10csmoothers_cBASMFactor *__pyx_v_basmFactor) {
6512 __pyx_t_10csmoothers_SuperMatrix __pyx_v_AS;
6513 __Pyx_RefNannyDeclarations
6514 PyObject *__pyx_t_1 = NULL;
6516 int __pyx_lineno = 0;
6517 const char *__pyx_filename = NULL;
6518 int __pyx_clineno = 0;
6519 __Pyx_RefNannySetupContext(
"smootherWrappers_basm_NR_prepare", 0);
6528 __pyx_v_AS.Dtype = SLU_D;
6537 __pyx_v_AS.Mtype = SLU_GE;
6546 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_sm), __pyx_n_s_nr);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 337, __pyx_L1_error)
6547 __Pyx_GOTREF(__pyx_t_1);
6548 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 337, __pyx_L1_error)
6549 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6550 __pyx_v_AS.nrow = __pyx_t_2;
6559 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_sm), __pyx_n_s_nc);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 338, __pyx_L1_error)
6560 __Pyx_GOTREF(__pyx_t_1);
6561 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 338, __pyx_L1_error)
6562 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6563 __pyx_v_AS.ncol = __pyx_t_2;
6572 __pyx_v_AS.Store = (&__pyx_v_sm->A);
6581 basm_NR_prepare(__pyx_v_basmFactor->bs, __pyx_v_basmFactor->N, (&__pyx_v_AS), __pyx_v_basmFactor->subdomain_dim, __pyx_v_basmFactor->l2g_L, __pyx_v_basmFactor->subdomain_L, __pyx_v_basmFactor->subdomain_pivots, __pyx_v_basmFactor->subdomain_col_pivots);
6594 __Pyx_XDECREF(__pyx_t_1);
6595 __Pyx_WriteUnraisable(
"csmoothers.smootherWrappers_basm_NR_prepare", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
6597 __Pyx_RefNannyFinishContext();
6609 static PyObject *__pyx_pw_10csmoothers_19basm_NR_solve(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
6610 static char __pyx_doc_10csmoothers_18basm_NR_solve[] =
"\n \n Arguments\n ---------\n A :\n w :\n basmFactor :\n node_order :\n R :\n dX :\n ";
6611 static PyMethodDef __pyx_mdef_10csmoothers_19basm_NR_solve = {
"basm_NR_solve", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_10csmoothers_19basm_NR_solve, METH_VARARGS|METH_KEYWORDS, __pyx_doc_10csmoothers_18basm_NR_solve};
6612 static PyObject *__pyx_pw_10csmoothers_19basm_NR_solve(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6613 PyObject *__pyx_v_A = 0;
6614 PyObject *__pyx_v_w = 0;
6615 PyObject *__pyx_v_basmFactor = 0;
6616 PyObject *__pyx_v_node_order = 0;
6617 PyObject *__pyx_v_R = 0;
6618 PyObject *__pyx_v_dX = 0;
6619 int __pyx_lineno = 0;
6620 const char *__pyx_filename = NULL;
6621 int __pyx_clineno = 0;
6622 PyObject *__pyx_r = 0;
6623 __Pyx_RefNannyDeclarations
6624 __Pyx_RefNannySetupContext(
"basm_NR_solve (wrapper)", 0);
6626 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_A,&__pyx_n_s_w,&__pyx_n_s_basmFactor,&__pyx_n_s_node_order,&__pyx_n_s_R,&__pyx_n_s_dX,0};
6627 PyObject* values[6] = {0,0,0,0,0,0};
6628 if (unlikely(__pyx_kwds)) {
6630 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6632 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
6634 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6636 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6638 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6640 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6642 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6645 default:
goto __pyx_L5_argtuple_error;
6647 kw_args = PyDict_Size(__pyx_kwds);
6650 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_A)) != 0)) kw_args--;
6651 else goto __pyx_L5_argtuple_error;
6654 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
6656 __Pyx_RaiseArgtupleInvalid(
"basm_NR_solve", 1, 6, 6, 1); __PYX_ERR(0, 350, __pyx_L3_error)
6660 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_basmFactor)) != 0)) kw_args--;
6662 __Pyx_RaiseArgtupleInvalid(
"basm_NR_solve", 1, 6, 6, 2); __PYX_ERR(0, 350, __pyx_L3_error)
6666 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_node_order)) != 0)) kw_args--;
6668 __Pyx_RaiseArgtupleInvalid(
"basm_NR_solve", 1, 6, 6, 3); __PYX_ERR(0, 350, __pyx_L3_error)
6672 if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_R)) != 0)) kw_args--;
6674 __Pyx_RaiseArgtupleInvalid(
"basm_NR_solve", 1, 6, 6, 4); __PYX_ERR(0, 350, __pyx_L3_error)
6678 if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dX)) != 0)) kw_args--;
6680 __Pyx_RaiseArgtupleInvalid(
"basm_NR_solve", 1, 6, 6, 5); __PYX_ERR(0, 350, __pyx_L3_error)
6683 if (unlikely(kw_args > 0)) {
6684 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"basm_NR_solve") < 0)) __PYX_ERR(0, 350, __pyx_L3_error)
6686 }
else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
6687 goto __pyx_L5_argtuple_error;
6689 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6690 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6691 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6692 values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6693 values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6694 values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
6696 __pyx_v_A = values[0];
6697 __pyx_v_w = values[1];
6698 __pyx_v_basmFactor = values[2];
6699 __pyx_v_node_order = values[3];
6700 __pyx_v_R = values[4];
6701 __pyx_v_dX = values[5];
6703 goto __pyx_L4_argument_unpacking_done;
6704 __pyx_L5_argtuple_error:;
6705 __Pyx_RaiseArgtupleInvalid(
"basm_NR_solve", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 350, __pyx_L3_error)
6707 __Pyx_AddTraceback(
"csmoothers.basm_NR_solve", __pyx_clineno, __pyx_lineno, __pyx_filename);
6708 __Pyx_RefNannyFinishContext();
6710 __pyx_L4_argument_unpacking_done:;
6711 __pyx_r = __pyx_pf_10csmoothers_18basm_NR_solve(__pyx_self, __pyx_v_A, __pyx_v_w, __pyx_v_basmFactor, __pyx_v_node_order, __pyx_v_R, __pyx_v_dX);
6714 __Pyx_RefNannyFinishContext();
6718 static PyObject *__pyx_pf_10csmoothers_18basm_NR_solve(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_w, PyObject *__pyx_v_basmFactor, PyObject *__pyx_v_node_order, PyObject *__pyx_v_R, PyObject *__pyx_v_dX) {
6719 PyObject *__pyx_r = NULL;
6720 __Pyx_RefNannyDeclarations
6721 PyObject *__pyx_t_1 = NULL;
6723 PyObject *__pyx_t_3 = NULL;
6724 __pyx_t_10csmoothers_IDATA __pyx_t_4 = { 0, 0, { 0 }, { 0 }, { 0 } };
6725 __pyx_t_10csmoothers_DDATA __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } };
6726 __pyx_t_10csmoothers_DDATA __pyx_t_6 = { 0, 0, { 0 }, { 0 }, { 0 } };
6727 int __pyx_lineno = 0;
6728 const char *__pyx_filename = NULL;
6729 int __pyx_clineno = 0;
6730 __Pyx_RefNannySetupContext(
"basm_NR_solve", 0);
6739 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_A, __pyx_n_s_cSparseMatrix);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 362, __pyx_L1_error)
6740 __Pyx_GOTREF(__pyx_t_1);
6741 if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7proteus_15superluWrappers_cSparseMatrix))))) __PYX_ERR(0, 362, __pyx_L1_error)
6750 __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_w);
if (unlikely((__pyx_t_2 == (
double)-1) && PyErr_Occurred())) __PYX_ERR(0, 363, __pyx_L1_error)
6759 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_basmFactor, __pyx_n_s_cBASMFactor);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 364, __pyx_L1_error)
6760 __Pyx_GOTREF(__pyx_t_3);
6761 if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_10csmoothers_cBASMFactor))))) __PYX_ERR(0, 364, __pyx_L1_error)
6770 __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_v_node_order, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(0, 365, __pyx_L1_error)
6779 __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_R, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(0, 366, __pyx_L1_error)
6788 __pyx_t_6 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_dX, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_6.memview)) __PYX_ERR(0, 367, __pyx_L1_error)
6797 __pyx_f_10csmoothers_smootherWrappers_basm_NR_solve(((
struct __pyx_obj_7proteus_15superluWrappers_cSparseMatrix *)__pyx_t_1), __pyx_t_2, ((
struct __pyx_obj_10csmoothers_cBASMFactor *)__pyx_t_3), __pyx_t_4, __pyx_t_5, __pyx_t_6);
6798 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6799 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6800 __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1);
6801 __pyx_t_4.memview = NULL;
6802 __pyx_t_4.data = NULL;
6803 __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
6804 __pyx_t_5.memview = NULL;
6805 __pyx_t_5.data = NULL;
6806 __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
6807 __pyx_t_6.memview = NULL;
6808 __pyx_t_6.data = NULL;
6819 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
6822 __Pyx_XDECREF(__pyx_t_1);
6823 __Pyx_XDECREF(__pyx_t_3);
6824 __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1);
6825 __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1);
6826 __PYX_XDEC_MEMVIEW(&__pyx_t_6, 1);
6827 __Pyx_AddTraceback(
"csmoothers.basm_NR_solve", __pyx_clineno, __pyx_lineno, __pyx_filename);
6830 __Pyx_XGIVEREF(__pyx_r);
6831 __Pyx_RefNannyFinishContext();
6843 static void __pyx_f_10csmoothers_smootherWrappers_basm_NR_solve(
struct __pyx_obj_7proteus_15superluWrappers_cSparseMatrix *__pyx_v_sm,
double __pyx_v_w,
struct __pyx_obj_10csmoothers_cBASMFactor *__pyx_v_basmFactor, __pyx_t_10csmoothers_IDATA __pyx_v_node_order, __pyx_t_10csmoothers_DDATA __pyx_v_R, __pyx_t_10csmoothers_DDATA __pyx_v_dX) {
6844 __pyx_t_10csmoothers_SuperMatrix __pyx_v_AS;
6845 __Pyx_RefNannyDeclarations
6846 PyObject *__pyx_t_1 = NULL;
6848 Py_ssize_t __pyx_t_3;
6849 Py_ssize_t __pyx_t_4;
6850 Py_ssize_t __pyx_t_5;
6851 int __pyx_lineno = 0;
6852 const char *__pyx_filename = NULL;
6853 int __pyx_clineno = 0;
6854 __Pyx_RefNannySetupContext(
"smootherWrappers_basm_NR_solve", 0);
6863 __pyx_v_AS.Stype = SLU_NR;
6872 __pyx_v_AS.Dtype = SLU_D;
6881 __pyx_v_AS.Mtype = SLU_GE;
6890 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_sm), __pyx_n_s_nr);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 379, __pyx_L1_error)
6891 __Pyx_GOTREF(__pyx_t_1);
6892 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 379, __pyx_L1_error)
6893 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6894 __pyx_v_AS.nrow = __pyx_t_2;
6903 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_sm), __pyx_n_s_nc);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 380, __pyx_L1_error)
6904 __Pyx_GOTREF(__pyx_t_1);
6905 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 380, __pyx_L1_error)
6906 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6907 __pyx_v_AS.ncol = __pyx_t_2;
6916 __pyx_v_AS.Store = (&__pyx_v_sm->A);
6927 if (__pyx_t_3 < 0) {
6928 __pyx_t_3 += __pyx_v_R.shape[0];
6929 if (unlikely(__pyx_t_3 < 0)) __pyx_t_2 = 0;
6930 }
else if (unlikely(__pyx_t_3 >= __pyx_v_R.shape[0])) __pyx_t_2 = 0;
6931 if (unlikely(__pyx_t_2 != -1)) {
6932 __Pyx_RaiseBufferIndexError(__pyx_t_2);
6933 __PYX_ERR(0, 389, __pyx_L1_error)
6945 if (__pyx_t_4 < 0) {
6946 __pyx_t_4 += __pyx_v_node_order.shape[0];
6947 if (unlikely(__pyx_t_4 < 0)) __pyx_t_2 = 0;
6948 }
else if (unlikely(__pyx_t_4 >= __pyx_v_node_order.shape[0])) __pyx_t_2 = 0;
6949 if (unlikely(__pyx_t_2 != -1)) {
6950 __Pyx_RaiseBufferIndexError(__pyx_t_2);
6951 __PYX_ERR(0, 391, __pyx_L1_error)
6963 if (__pyx_t_5 < 0) {
6964 __pyx_t_5 += __pyx_v_dX.shape[0];
6965 if (unlikely(__pyx_t_5 < 0)) __pyx_t_2 = 0;
6966 }
else if (unlikely(__pyx_t_5 >= __pyx_v_dX.shape[0])) __pyx_t_2 = 0;
6967 if (unlikely(__pyx_t_2 != -1)) {
6968 __Pyx_RaiseBufferIndexError(__pyx_t_2);
6969 __PYX_ERR(0, 393, __pyx_L1_error)
6979 basm_NR_solve(__pyx_v_basmFactor->bs, __pyx_v_basmFactor->N, (&__pyx_v_AS), __pyx_v_w, __pyx_v_basmFactor->subdomain_L, __pyx_v_basmFactor->subdomain_dim, __pyx_v_basmFactor->l2g_L, (&(*((
double *) ( (__pyx_v_R.data + __pyx_t_3 * __pyx_v_R.strides[0]) )))), __pyx_v_basmFactor->subdomain_R, (&(*((
int *) ( (__pyx_v_node_order.data + __pyx_t_4 * __pyx_v_node_order.strides[0]) )))), __pyx_v_basmFactor->subdomain_dX, (&(*((
double *) ( (__pyx_v_dX.data + __pyx_t_5 * __pyx_v_dX.strides[0]) )))), __pyx_v_basmFactor->subdomain_pivots, __pyx_v_basmFactor->subdomain_col_pivots);
6992 __Pyx_XDECREF(__pyx_t_1);
6993 __Pyx_WriteUnraisable(
"csmoothers.smootherWrappers_basm_NR_solve", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
6995 __Pyx_RefNannyFinishContext();
7006 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
7007 PyObject *__pyx_r = NULL;
7008 __Pyx_RefNannyDeclarations
7009 PyObject *__pyx_t_1 = NULL;
7010 int __pyx_lineno = 0;
7011 const char *__pyx_filename = NULL;
7012 int __pyx_clineno = 0;
7013 __Pyx_RefNannySetupContext(
"PyArray_MultiIterNew1", 0);
7022 __Pyx_XDECREF(__pyx_r);
7023 __pyx_t_1 = PyArray_MultiIterNew(1, ((
void *)__pyx_v_a));
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 736, __pyx_L1_error)
7024 __Pyx_GOTREF(__pyx_t_1);
7025 __pyx_r = __pyx_t_1;
7039 __Pyx_XDECREF(__pyx_t_1);
7040 __Pyx_AddTraceback(
"numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
7043 __Pyx_XGIVEREF(__pyx_r);
7044 __Pyx_RefNannyFinishContext();
7056 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
7057 PyObject *__pyx_r = NULL;
7058 __Pyx_RefNannyDeclarations
7059 PyObject *__pyx_t_1 = NULL;
7060 int __pyx_lineno = 0;
7061 const char *__pyx_filename = NULL;
7062 int __pyx_clineno = 0;
7063 __Pyx_RefNannySetupContext(
"PyArray_MultiIterNew2", 0);
7072 __Pyx_XDECREF(__pyx_r);
7073 __pyx_t_1 = PyArray_MultiIterNew(2, ((
void *)__pyx_v_a), ((
void *)__pyx_v_b));
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 739, __pyx_L1_error)
7074 __Pyx_GOTREF(__pyx_t_1);
7075 __pyx_r = __pyx_t_1;
7089 __Pyx_XDECREF(__pyx_t_1);
7090 __Pyx_AddTraceback(
"numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
7093 __Pyx_XGIVEREF(__pyx_r);
7094 __Pyx_RefNannyFinishContext();
7106 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
7107 PyObject *__pyx_r = NULL;
7108 __Pyx_RefNannyDeclarations
7109 PyObject *__pyx_t_1 = NULL;
7110 int __pyx_lineno = 0;
7111 const char *__pyx_filename = NULL;
7112 int __pyx_clineno = 0;
7113 __Pyx_RefNannySetupContext(
"PyArray_MultiIterNew3", 0);
7122 __Pyx_XDECREF(__pyx_r);
7123 __pyx_t_1 = PyArray_MultiIterNew(3, ((
void *)__pyx_v_a), ((
void *)__pyx_v_b), ((
void *)__pyx_v_c));
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 742, __pyx_L1_error)
7124 __Pyx_GOTREF(__pyx_t_1);
7125 __pyx_r = __pyx_t_1;
7139 __Pyx_XDECREF(__pyx_t_1);
7140 __Pyx_AddTraceback(
"numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
7143 __Pyx_XGIVEREF(__pyx_r);
7144 __Pyx_RefNannyFinishContext();
7156 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) {
7157 PyObject *__pyx_r = NULL;
7158 __Pyx_RefNannyDeclarations
7159 PyObject *__pyx_t_1 = NULL;
7160 int __pyx_lineno = 0;
7161 const char *__pyx_filename = NULL;
7162 int __pyx_clineno = 0;
7163 __Pyx_RefNannySetupContext(
"PyArray_MultiIterNew4", 0);
7172 __Pyx_XDECREF(__pyx_r);
7173 __pyx_t_1 = PyArray_MultiIterNew(4, ((
void *)__pyx_v_a), ((
void *)__pyx_v_b), ((
void *)__pyx_v_c), ((
void *)__pyx_v_d));
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 745, __pyx_L1_error)
7174 __Pyx_GOTREF(__pyx_t_1);
7175 __pyx_r = __pyx_t_1;
7189 __Pyx_XDECREF(__pyx_t_1);
7190 __Pyx_AddTraceback(
"numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
7193 __Pyx_XGIVEREF(__pyx_r);
7194 __Pyx_RefNannyFinishContext();
7206 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) {
7207 PyObject *__pyx_r = NULL;
7208 __Pyx_RefNannyDeclarations
7209 PyObject *__pyx_t_1 = NULL;
7210 int __pyx_lineno = 0;
7211 const char *__pyx_filename = NULL;
7212 int __pyx_clineno = 0;
7213 __Pyx_RefNannySetupContext(
"PyArray_MultiIterNew5", 0);
7222 __Pyx_XDECREF(__pyx_r);
7223 __pyx_t_1 = PyArray_MultiIterNew(5, ((
void *)__pyx_v_a), ((
void *)__pyx_v_b), ((
void *)__pyx_v_c), ((
void *)__pyx_v_d), ((
void *)__pyx_v_e));
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 748, __pyx_L1_error)
7224 __Pyx_GOTREF(__pyx_t_1);
7225 __pyx_r = __pyx_t_1;
7239 __Pyx_XDECREF(__pyx_t_1);
7240 __Pyx_AddTraceback(
"numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
7243 __Pyx_XGIVEREF(__pyx_r);
7244 __Pyx_RefNannyFinishContext();
7256 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_Descr *__pyx_v_d) {
7257 PyObject *__pyx_r = NULL;
7258 __Pyx_RefNannyDeclarations
7260 __Pyx_RefNannySetupContext(
"PyDataType_SHAPE", 0);
7269 __pyx_t_1 = (PyDataType_HASSUBARRAY(__pyx_v_d) != 0);
7279 __Pyx_XDECREF(__pyx_r);
7280 __Pyx_INCREF(((PyObject*)__pyx_v_d->subarray->shape));
7281 __pyx_r = ((PyObject*)__pyx_v_d->subarray->shape);
7301 __Pyx_XDECREF(__pyx_r);
7302 __Pyx_INCREF(__pyx_empty_tuple);
7303 __pyx_r = __pyx_empty_tuple;
7317 __Pyx_XGIVEREF(__pyx_r);
7318 __Pyx_RefNannyFinishContext();
7330 static CYTHON_INLINE
void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
7331 __Pyx_RefNannyDeclarations
7332 __Pyx_RefNannySetupContext(
"set_array_base", 0);
7341 Py_INCREF(__pyx_v_base);
7350 (void)(PyArray_SetBaseObject(__pyx_v_arr, __pyx_v_base));
7361 __Pyx_RefNannyFinishContext();
7372 static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
7373 PyObject *__pyx_v_base;
7374 PyObject *__pyx_r = NULL;
7375 __Pyx_RefNannyDeclarations
7377 __Pyx_RefNannySetupContext(
"get_array_base", 0);
7386 __pyx_v_base = PyArray_BASE(__pyx_v_arr);
7395 __pyx_t_1 = ((__pyx_v_base == NULL) != 0);
7405 __Pyx_XDECREF(__pyx_r);
7406 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
7425 __Pyx_XDECREF(__pyx_r);
7426 __Pyx_INCREF(((PyObject *)__pyx_v_base));
7427 __pyx_r = ((PyObject *)__pyx_v_base);
7440 __Pyx_XGIVEREF(__pyx_r);
7441 __Pyx_RefNannyFinishContext();
7453 static CYTHON_INLINE
int __pyx_f_5numpy_import_array(
void) {
7455 __Pyx_RefNannyDeclarations
7456 PyObject *__pyx_t_1 = NULL;
7457 PyObject *__pyx_t_2 = NULL;
7458 PyObject *__pyx_t_3 = NULL;
7460 PyObject *__pyx_t_5 = NULL;
7461 PyObject *__pyx_t_6 = NULL;
7462 PyObject *__pyx_t_7 = NULL;
7463 PyObject *__pyx_t_8 = NULL;
7464 int __pyx_lineno = 0;
7465 const char *__pyx_filename = NULL;
7466 int __pyx_clineno = 0;
7467 __Pyx_RefNannySetupContext(
"import_array", 0);
7477 __Pyx_PyThreadState_declare
7478 __Pyx_PyThreadState_assign
7479 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
7480 __Pyx_XGOTREF(__pyx_t_1);
7481 __Pyx_XGOTREF(__pyx_t_2);
7482 __Pyx_XGOTREF(__pyx_t_3);
7492 __pyx_t_4 = _import_array();
if (unlikely(__pyx_t_4 == ((
int)-1))) __PYX_ERR(2, 943, __pyx_L3_error)
7502 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7503 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
7504 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7505 goto __pyx_L8_try_end;
7515 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
7517 __Pyx_AddTraceback(
"numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
7518 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 944, __pyx_L5_except_error)
7519 __Pyx_GOTREF(__pyx_t_5);
7520 __Pyx_GOTREF(__pyx_t_6);
7521 __Pyx_GOTREF(__pyx_t_7);
7530 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__5, NULL);
if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 945, __pyx_L5_except_error)
7531 __Pyx_GOTREF(__pyx_t_8);
7532 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
7533 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7534 __PYX_ERR(2, 945, __pyx_L5_except_error)
7536 goto __pyx_L5_except_error;
7537 __pyx_L5_except_error:;
7546 __Pyx_XGIVEREF(__pyx_t_1);
7547 __Pyx_XGIVEREF(__pyx_t_2);
7548 __Pyx_XGIVEREF(__pyx_t_3);
7549 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
7550 goto __pyx_L1_error;
7566 __Pyx_XDECREF(__pyx_t_5);
7567 __Pyx_XDECREF(__pyx_t_6);
7568 __Pyx_XDECREF(__pyx_t_7);
7569 __Pyx_XDECREF(__pyx_t_8);
7570 __Pyx_AddTraceback(
"numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
7573 __Pyx_RefNannyFinishContext();
7585 static CYTHON_INLINE
int __pyx_f_5numpy_import_umath(
void) {
7587 __Pyx_RefNannyDeclarations
7588 PyObject *__pyx_t_1 = NULL;
7589 PyObject *__pyx_t_2 = NULL;
7590 PyObject *__pyx_t_3 = NULL;
7592 PyObject *__pyx_t_5 = NULL;
7593 PyObject *__pyx_t_6 = NULL;
7594 PyObject *__pyx_t_7 = NULL;
7595 PyObject *__pyx_t_8 = NULL;
7596 int __pyx_lineno = 0;
7597 const char *__pyx_filename = NULL;
7598 int __pyx_clineno = 0;
7599 __Pyx_RefNannySetupContext(
"import_umath", 0);
7609 __Pyx_PyThreadState_declare
7610 __Pyx_PyThreadState_assign
7611 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
7612 __Pyx_XGOTREF(__pyx_t_1);
7613 __Pyx_XGOTREF(__pyx_t_2);
7614 __Pyx_XGOTREF(__pyx_t_3);
7624 __pyx_t_4 = _import_umath();
if (unlikely(__pyx_t_4 == ((
int)-1))) __PYX_ERR(2, 949, __pyx_L3_error)
7634 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7635 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
7636 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7637 goto __pyx_L8_try_end;
7647 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
7649 __Pyx_AddTraceback(
"numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
7650 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 950, __pyx_L5_except_error)
7651 __Pyx_GOTREF(__pyx_t_5);
7652 __Pyx_GOTREF(__pyx_t_6);
7653 __Pyx_GOTREF(__pyx_t_7);
7662 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__6, NULL);
if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 951, __pyx_L5_except_error)
7663 __Pyx_GOTREF(__pyx_t_8);
7664 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
7665 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7666 __PYX_ERR(2, 951, __pyx_L5_except_error)
7668 goto __pyx_L5_except_error;
7669 __pyx_L5_except_error:;
7678 __Pyx_XGIVEREF(__pyx_t_1);
7679 __Pyx_XGIVEREF(__pyx_t_2);
7680 __Pyx_XGIVEREF(__pyx_t_3);
7681 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
7682 goto __pyx_L1_error;
7698 __Pyx_XDECREF(__pyx_t_5);
7699 __Pyx_XDECREF(__pyx_t_6);
7700 __Pyx_XDECREF(__pyx_t_7);
7701 __Pyx_XDECREF(__pyx_t_8);
7702 __Pyx_AddTraceback(
"numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
7705 __Pyx_RefNannyFinishContext();
7717 static CYTHON_INLINE
int __pyx_f_5numpy_import_ufunc(
void) {
7719 __Pyx_RefNannyDeclarations
7720 PyObject *__pyx_t_1 = NULL;
7721 PyObject *__pyx_t_2 = NULL;
7722 PyObject *__pyx_t_3 = NULL;
7724 PyObject *__pyx_t_5 = NULL;
7725 PyObject *__pyx_t_6 = NULL;
7726 PyObject *__pyx_t_7 = NULL;
7727 PyObject *__pyx_t_8 = NULL;
7728 int __pyx_lineno = 0;
7729 const char *__pyx_filename = NULL;
7730 int __pyx_clineno = 0;
7731 __Pyx_RefNannySetupContext(
"import_ufunc", 0);
7741 __Pyx_PyThreadState_declare
7742 __Pyx_PyThreadState_assign
7743 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
7744 __Pyx_XGOTREF(__pyx_t_1);
7745 __Pyx_XGOTREF(__pyx_t_2);
7746 __Pyx_XGOTREF(__pyx_t_3);
7756 __pyx_t_4 = _import_umath();
if (unlikely(__pyx_t_4 == ((
int)-1))) __PYX_ERR(2, 955, __pyx_L3_error)
7766 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
7767 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
7768 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
7769 goto __pyx_L8_try_end;
7779 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
7781 __Pyx_AddTraceback(
"numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
7782 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(2, 956, __pyx_L5_except_error)
7783 __Pyx_GOTREF(__pyx_t_5);
7784 __Pyx_GOTREF(__pyx_t_6);
7785 __Pyx_GOTREF(__pyx_t_7);
7794 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__6, NULL);
if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 957, __pyx_L5_except_error)
7795 __Pyx_GOTREF(__pyx_t_8);
7796 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
7797 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
7798 __PYX_ERR(2, 957, __pyx_L5_except_error)
7800 goto __pyx_L5_except_error;
7801 __pyx_L5_except_error:;
7810 __Pyx_XGIVEREF(__pyx_t_1);
7811 __Pyx_XGIVEREF(__pyx_t_2);
7812 __Pyx_XGIVEREF(__pyx_t_3);
7813 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
7814 goto __pyx_L1_error;
7830 __Pyx_XDECREF(__pyx_t_5);
7831 __Pyx_XDECREF(__pyx_t_6);
7832 __Pyx_XDECREF(__pyx_t_7);
7833 __Pyx_XDECREF(__pyx_t_8);
7834 __Pyx_AddTraceback(
"numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
7837 __Pyx_RefNannyFinishContext();
7849 static CYTHON_INLINE
int __pyx_f_5numpy_is_timedelta64_object(PyObject *__pyx_v_obj) {
7851 __Pyx_RefNannyDeclarations
7852 __Pyx_RefNannySetupContext(
"is_timedelta64_object", 0);
7861 __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyTimedeltaArrType_Type));
7874 __Pyx_RefNannyFinishContext();
7886 static CYTHON_INLINE
int __pyx_f_5numpy_is_datetime64_object(PyObject *__pyx_v_obj) {
7888 __Pyx_RefNannyDeclarations
7889 __Pyx_RefNannySetupContext(
"is_datetime64_object", 0);
7898 __pyx_r = PyObject_TypeCheck(__pyx_v_obj, (&PyDatetimeArrType_Type));
7911 __Pyx_RefNannyFinishContext();
7923 static CYTHON_INLINE npy_datetime __pyx_f_5numpy_get_datetime64_value(PyObject *__pyx_v_obj) {
7924 npy_datetime __pyx_r;
7933 __pyx_r = ((PyDatetimeScalarObject *)__pyx_v_obj)->obval;
7957 static CYTHON_INLINE npy_timedelta __pyx_f_5numpy_get_timedelta64_value(PyObject *__pyx_v_obj) {
7958 npy_timedelta __pyx_r;
7967 __pyx_r = ((PyTimedeltaScalarObject *)__pyx_v_obj)->obval;
7991 static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObject *__pyx_v_obj) {
7992 NPY_DATETIMEUNIT __pyx_r;
7999 __pyx_r = ((NPY_DATETIMEUNIT)((PyDatetimeScalarObject *)__pyx_v_obj)->obmeta.base);
8024 static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
8025 static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8026 PyObject *__pyx_v_shape = 0;
8027 Py_ssize_t __pyx_v_itemsize;
8028 PyObject *__pyx_v_format = 0;
8029 PyObject *__pyx_v_mode = 0;
8030 int __pyx_v_allocate_buffer;
8031 int __pyx_lineno = 0;
8032 const char *__pyx_filename = NULL;
8033 int __pyx_clineno = 0;
8035 __Pyx_RefNannyDeclarations
8036 __Pyx_RefNannySetupContext(
"__cinit__ (wrapper)", 0);
8038 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shape,&__pyx_n_s_itemsize,&__pyx_n_s_format,&__pyx_n_s_mode,&__pyx_n_s_allocate_buffer,0};
8039 PyObject* values[5] = {0,0,0,0,0};
8040 values[3] = ((PyObject *)__pyx_n_s_c);
8041 if (unlikely(__pyx_kwds)) {
8043 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8045 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
8047 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8049 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8051 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8053 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8056 default:
goto __pyx_L5_argtuple_error;
8058 kw_args = PyDict_Size(__pyx_kwds);
8061 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--;
8062 else goto __pyx_L5_argtuple_error;
8065 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--;
8067 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 0, 3, 5, 1); __PYX_ERR(1, 122, __pyx_L3_error)
8071 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--;
8073 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 0, 3, 5, 2); __PYX_ERR(1, 122, __pyx_L3_error)
8078 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode);
8079 if (value) { values[3] = value; kw_args--; }
8084 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allocate_buffer);
8085 if (value) { values[4] = value; kw_args--; }
8088 if (unlikely(kw_args > 0)) {
8089 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__cinit__") < 0)) __PYX_ERR(1, 122, __pyx_L3_error)
8092 switch (PyTuple_GET_SIZE(__pyx_args)) {
8093 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
8095 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
8097 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8098 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8099 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8101 default:
goto __pyx_L5_argtuple_error;
8104 __pyx_v_shape = ((PyObject*)values[0]);
8105 __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]);
if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 122, __pyx_L3_error)
8106 __pyx_v_format = values[2];
8107 __pyx_v_mode = values[3];
8109 __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]);
if (unlikely((__pyx_v_allocate_buffer == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 123, __pyx_L3_error)
8119 __pyx_v_allocate_buffer = ((int)1);
8122 goto __pyx_L4_argument_unpacking_done;
8123 __pyx_L5_argtuple_error:;
8124 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 122, __pyx_L3_error)
8126 __Pyx_AddTraceback(
"View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8127 __Pyx_RefNannyFinishContext();
8129 __pyx_L4_argument_unpacking_done:;
8130 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1,
"shape", 1))) __PYX_ERR(1, 122, __pyx_L1_error)
8131 if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) {
8132 PyErr_Format(PyExc_TypeError,
"Argument '%.200s' must not be None",
"format"); __PYX_ERR(1, 122, __pyx_L1_error)
8134 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((
struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer);
8149 __Pyx_RefNannyFinishContext();
8153 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode,
int __pyx_v_allocate_buffer) {
8155 Py_ssize_t __pyx_v_i;
8156 Py_ssize_t __pyx_v_dim;
8157 PyObject **__pyx_v_p;
8160 __Pyx_RefNannyDeclarations
8161 Py_ssize_t __pyx_t_1;
8163 PyObject *__pyx_t_3 = NULL;
8165 PyObject *__pyx_t_5 = NULL;
8166 PyObject *__pyx_t_6 = NULL;
8169 Py_ssize_t __pyx_t_9;
8170 PyObject *__pyx_t_10 = NULL;
8171 Py_ssize_t __pyx_t_11;
8172 int __pyx_lineno = 0;
8173 const char *__pyx_filename = NULL;
8174 int __pyx_clineno = 0;
8175 __Pyx_RefNannySetupContext(
"__cinit__", 0);
8176 __Pyx_INCREF(__pyx_v_format);
8185 if (unlikely(__pyx_v_shape == Py_None)) {
8186 PyErr_SetString(PyExc_TypeError,
"object of type 'NoneType' has no len()");
8187 __PYX_ERR(1, 129, __pyx_L1_error)
8189 __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_shape);
if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(1, 129, __pyx_L1_error)
8190 __pyx_v_self->ndim = ((int)__pyx_t_1);
8199 __pyx_v_self->itemsize = __pyx_v_itemsize;
8208 __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0);
8209 if (unlikely(__pyx_t_2)) {
8218 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__7, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 133, __pyx_L1_error)
8219 __Pyx_GOTREF(__pyx_t_3);
8220 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
8221 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8222 __PYX_ERR(1, 133, __pyx_L1_error)
8240 __pyx_t_2 = ((__pyx_v_itemsize <= 0) != 0);
8241 if (unlikely(__pyx_t_2)) {
8250 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__8, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 136, __pyx_L1_error)
8251 __Pyx_GOTREF(__pyx_t_3);
8252 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
8253 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8254 __PYX_ERR(1, 136, __pyx_L1_error)
8272 __pyx_t_2 = PyBytes_Check(__pyx_v_format);
8273 __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0);
8283 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 139, __pyx_L1_error)
8284 __Pyx_GOTREF(__pyx_t_5);
8286 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
8287 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
8288 if (likely(__pyx_t_6)) {
8289 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_5);
8290 __Pyx_INCREF(__pyx_t_6);
8291 __Pyx_INCREF(
function);
8292 __Pyx_DECREF_SET(__pyx_t_5,
function);
8295 __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_n_s_ASCII) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_s_ASCII);
8296 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
8297 if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 139, __pyx_L1_error)
8298 __Pyx_GOTREF(__pyx_t_3);
8299 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8300 __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3);
8319 if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None)||(PyErr_Format(PyExc_TypeError,
"Expected %.16s, got %.200s",
"bytes", Py_TYPE(__pyx_v_format)->tp_name), 0))) __PYX_ERR(1, 140, __pyx_L1_error)
8320 __pyx_t_3 = __pyx_v_format;
8321 __Pyx_INCREF(__pyx_t_3);
8322 __Pyx_GIVEREF(__pyx_t_3);
8323 __Pyx_GOTREF(__pyx_v_self->_format);
8324 __Pyx_DECREF(__pyx_v_self->_format);
8325 __pyx_v_self->_format = ((PyObject*)__pyx_t_3);
8335 if (unlikely(__pyx_v_self->_format == Py_None)) {
8336 PyErr_SetString(PyExc_TypeError,
"expected bytes, NoneType found");
8337 __PYX_ERR(1, 141, __pyx_L1_error)
8339 __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format);
if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(1, 141, __pyx_L1_error)
8340 __pyx_v_self->format = __pyx_t_7;
8349 __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((
sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2)));
8358 __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim);
8367 __pyx_t_4 = ((!(__pyx_v_self->_shape != 0)) != 0);
8368 if (unlikely(__pyx_t_4)) {
8377 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__9, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 148, __pyx_L1_error)
8378 __Pyx_GOTREF(__pyx_t_3);
8379 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
8380 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8381 __PYX_ERR(1, 148, __pyx_L1_error)
8400 __pyx_t_3 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
8402 if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3))
break;
8403 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
8404 __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++;
if (unlikely(0 < 0)) __PYX_ERR(1, 151, __pyx_L1_error)
8406 __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++;
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 151, __pyx_L1_error)
8407 __Pyx_GOTREF(__pyx_t_5);
8409 __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5);
if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 151, __pyx_L1_error)
8410 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
8411 __pyx_v_dim = __pyx_t_9;
8412 __pyx_v_idx = __pyx_t_8;
8413 __pyx_t_8 = (__pyx_t_8 + 1);
8422 __pyx_t_4 = ((__pyx_v_dim <= 0) != 0);
8423 if (unlikely(__pyx_t_4)) {
8432 __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 153, __pyx_L1_error)
8433 __Pyx_GOTREF(__pyx_t_5);
8434 __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_dim);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 153, __pyx_L1_error)
8435 __Pyx_GOTREF(__pyx_t_6);
8436 __pyx_t_10 = PyTuple_New(2);
if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 153, __pyx_L1_error)
8437 __Pyx_GOTREF(__pyx_t_10);
8438 __Pyx_GIVEREF(__pyx_t_5);
8439 PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5);
8440 __Pyx_GIVEREF(__pyx_t_6);
8441 PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6);
8444 __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_t_10);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 153, __pyx_L1_error)
8445 __Pyx_GOTREF(__pyx_t_6);
8446 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
8447 __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6);
if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 153, __pyx_L1_error)
8448 __Pyx_GOTREF(__pyx_t_10);
8449 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8450 __Pyx_Raise(__pyx_t_10, 0, 0, 0);
8451 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
8452 __PYX_ERR(1, 153, __pyx_L1_error)
8470 (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim;
8480 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8489 __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ));
if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 157, __pyx_L1_error)
8499 __pyx_v_order =
'F';
8508 __Pyx_INCREF(__pyx_n_u_fortran);
8509 __Pyx_GIVEREF(__pyx_n_u_fortran);
8510 __Pyx_GOTREF(__pyx_v_self->mode);
8511 __Pyx_DECREF(__pyx_v_self->mode);
8512 __pyx_v_self->mode = __pyx_n_u_fortran;
8531 __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ));
if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(1, 160, __pyx_L1_error)
8532 if (likely(__pyx_t_4)) {
8541 __pyx_v_order =
'C';
8550 __Pyx_INCREF(__pyx_n_u_c);
8551 __Pyx_GIVEREF(__pyx_n_u_c);
8552 __Pyx_GOTREF(__pyx_v_self->mode);
8553 __Pyx_DECREF(__pyx_v_self->mode);
8554 __pyx_v_self->mode = __pyx_n_u_c;
8574 __pyx_t_3 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_v_mode);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 164, __pyx_L1_error)
8575 __Pyx_GOTREF(__pyx_t_3);
8576 __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3);
if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 164, __pyx_L1_error)
8577 __Pyx_GOTREF(__pyx_t_10);
8578 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8579 __Pyx_Raise(__pyx_t_10, 0, 0, 0);
8580 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
8581 __PYX_ERR(1, 164, __pyx_L1_error)
8592 __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order);
8601 __pyx_v_self->free_data = __pyx_v_allocate_buffer;
8610 __pyx_t_10 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_10);
if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 170, __pyx_L1_error)
8611 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10);
if (unlikely((__pyx_t_4 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 170, __pyx_L1_error)
8612 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
8613 __pyx_v_self->dtype_is_object = __pyx_t_4;
8622 __pyx_t_4 = (__pyx_v_allocate_buffer != 0);
8632 __pyx_v_self->data = ((
char *)malloc(__pyx_v_self->len));
8641 __pyx_t_4 = ((!(__pyx_v_self->data != 0)) != 0);
8642 if (unlikely(__pyx_t_4)) {
8651 __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__10, NULL);
if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 176, __pyx_L1_error)
8652 __Pyx_GOTREF(__pyx_t_10);
8653 __Pyx_Raise(__pyx_t_10, 0, 0, 0);
8654 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
8655 __PYX_ERR(1, 176, __pyx_L1_error)
8673 __pyx_t_4 = (__pyx_v_self->dtype_is_object != 0);
8683 __pyx_v_p = ((PyObject **)__pyx_v_self->data);
8692 if (unlikely(__pyx_v_itemsize == 0)) {
8693 PyErr_SetString(PyExc_ZeroDivisionError,
"integer division or modulo by zero");
8694 __PYX_ERR(1, 180, __pyx_L1_error)
8696 else if (
sizeof(Py_ssize_t) ==
sizeof(
long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) {
8697 PyErr_SetString(PyExc_OverflowError,
"value too large to perform division");
8698 __PYX_ERR(1, 180, __pyx_L1_error)
8700 __pyx_t_1 = __Pyx_div_Py_ssize_t(__pyx_v_self->len, __pyx_v_itemsize);
8701 __pyx_t_9 = __pyx_t_1;
8702 for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
8703 __pyx_v_i = __pyx_t_11;
8712 (__pyx_v_p[__pyx_v_i]) = Py_None;
8754 __Pyx_XDECREF(__pyx_t_3);
8755 __Pyx_XDECREF(__pyx_t_5);
8756 __Pyx_XDECREF(__pyx_t_6);
8757 __Pyx_XDECREF(__pyx_t_10);
8758 __Pyx_AddTraceback(
"View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8761 __Pyx_XDECREF(__pyx_v_format);
8762 __Pyx_RefNannyFinishContext();
8775 static CYTHON_UNUSED
int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
8776 static CYTHON_UNUSED
int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags) {
8778 __Pyx_RefNannyDeclarations
8779 __Pyx_RefNannySetupContext(
"__getbuffer__ (wrapper)", 0);
8780 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((
struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((
int)__pyx_v_flags));
8783 __Pyx_RefNannyFinishContext();
8787 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(
struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags) {
8788 int __pyx_v_bufmode;
8790 __Pyx_RefNannyDeclarations
8793 PyObject *__pyx_t_3 = NULL;
8795 Py_ssize_t __pyx_t_5;
8797 Py_ssize_t *__pyx_t_7;
8798 int __pyx_lineno = 0;
8799 const char *__pyx_filename = NULL;
8800 int __pyx_clineno = 0;
8801 if (__pyx_v_info == NULL) {
8802 PyErr_SetString(PyExc_BufferError,
"PyObject_GetBuffer: view==NULL argument is obsolete");
8805 __Pyx_RefNannySetupContext(
"__getbuffer__", 0);
8806 __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
8807 __Pyx_GIVEREF(__pyx_v_info->obj);
8816 __pyx_v_bufmode = -1;
8825 __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ));
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 187, __pyx_L1_error)
8826 __pyx_t_2 = (__pyx_t_1 != 0);
8836 __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
8855 __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ));
if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 189, __pyx_L1_error)
8856 __pyx_t_1 = (__pyx_t_2 != 0);
8866 __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
8885 __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0);
8886 if (unlikely(__pyx_t_1)) {
8895 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 192, __pyx_L1_error)
8896 __Pyx_GOTREF(__pyx_t_3);
8897 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
8898 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8899 __PYX_ERR(1, 192, __pyx_L1_error)
8917 __pyx_t_4 = __pyx_v_self->data;
8918 __pyx_v_info->buf = __pyx_t_4;
8927 __pyx_t_5 = __pyx_v_self->len;
8928 __pyx_v_info->len = __pyx_t_5;
8937 __pyx_t_6 = __pyx_v_self->ndim;
8938 __pyx_v_info->ndim = __pyx_t_6;
8947 __pyx_t_7 = __pyx_v_self->_shape;
8948 __pyx_v_info->shape = __pyx_t_7;
8957 __pyx_t_7 = __pyx_v_self->_strides;
8958 __pyx_v_info->strides = __pyx_t_7;
8967 __pyx_v_info->suboffsets = NULL;
8976 __pyx_t_5 = __pyx_v_self->itemsize;
8977 __pyx_v_info->itemsize = __pyx_t_5;
8986 __pyx_v_info->readonly = 0;
8995 __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
9005 __pyx_t_4 = __pyx_v_self->format;
9006 __pyx_v_info->format = __pyx_t_4;
9026 __pyx_v_info->format = NULL;
9037 __Pyx_INCREF(((PyObject *)__pyx_v_self));
9038 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
9039 __Pyx_GOTREF(__pyx_v_info->obj);
9040 __Pyx_DECREF(__pyx_v_info->obj);
9041 __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
9055 __Pyx_XDECREF(__pyx_t_3);
9056 __Pyx_AddTraceback(
"View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9058 if (__pyx_v_info->obj != NULL) {
9059 __Pyx_GOTREF(__pyx_v_info->obj);
9060 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
9064 if (__pyx_v_info->obj == Py_None) {
9065 __Pyx_GOTREF(__pyx_v_info->obj);
9066 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
9069 __Pyx_RefNannyFinishContext();
9082 static void __pyx_array___dealloc__(PyObject *__pyx_v_self);
9083 static void __pyx_array___dealloc__(PyObject *__pyx_v_self) {
9084 __Pyx_RefNannyDeclarations
9085 __Pyx_RefNannySetupContext(
"__dealloc__ (wrapper)", 0);
9086 __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((
struct __pyx_array_obj *)__pyx_v_self));
9089 __Pyx_RefNannyFinishContext();
9092 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(
struct __pyx_array_obj *__pyx_v_self) {
9093 __Pyx_RefNannyDeclarations
9095 __Pyx_RefNannySetupContext(
"__dealloc__", 0);
9104 __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0);
9114 __pyx_v_self->callback_free_data(__pyx_v_self->data);
9133 __pyx_t_1 = (__pyx_v_self->free_data != 0);
9143 __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
9153 __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0);
9171 free(__pyx_v_self->data);
9190 PyObject_Free(__pyx_v_self->_shape);
9201 __Pyx_RefNannyFinishContext();
9213 static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self);
9214 static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) {
9215 PyObject *__pyx_r = 0;
9216 __Pyx_RefNannyDeclarations
9217 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
9218 __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((
struct __pyx_array_obj *)__pyx_v_self));
9221 __Pyx_RefNannyFinishContext();
9225 static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(
struct __pyx_array_obj *__pyx_v_self) {
9226 PyObject *__pyx_r = NULL;
9227 __Pyx_RefNannyDeclarations
9228 PyObject *__pyx_t_1 = NULL;
9229 int __pyx_lineno = 0;
9230 const char *__pyx_filename = NULL;
9231 int __pyx_clineno = 0;
9232 __Pyx_RefNannySetupContext(
"__get__", 0);
9241 __Pyx_XDECREF(__pyx_r);
9242 __pyx_t_1 = ((
struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 223, __pyx_L1_error)
9243 __Pyx_GOTREF(__pyx_t_1);
9244 __pyx_r = __pyx_t_1;
9258 __Pyx_XDECREF(__pyx_t_1);
9259 __Pyx_AddTraceback(
"View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9262 __Pyx_XGIVEREF(__pyx_r);
9263 __Pyx_RefNannyFinishContext();
9275 static PyObject *__pyx_array_get_memview(
struct __pyx_array_obj *__pyx_v_self) {
9277 PyObject *__pyx_r = NULL;
9278 __Pyx_RefNannyDeclarations
9279 PyObject *__pyx_t_1 = NULL;
9280 PyObject *__pyx_t_2 = NULL;
9281 PyObject *__pyx_t_3 = NULL;
9282 int __pyx_lineno = 0;
9283 const char *__pyx_filename = NULL;
9284 int __pyx_clineno = 0;
9285 __Pyx_RefNannySetupContext(
"get_memview", 0);
9294 __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE);
9303 __Pyx_XDECREF(__pyx_r);
9304 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 228, __pyx_L1_error)
9305 __Pyx_GOTREF(__pyx_t_1);
9306 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 228, __pyx_L1_error)
9307 __Pyx_GOTREF(__pyx_t_2);
9308 __pyx_t_3 = PyTuple_New(3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 228, __pyx_L1_error)
9309 __Pyx_GOTREF(__pyx_t_3);
9310 __Pyx_INCREF(((PyObject *)__pyx_v_self));
9311 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
9312 PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self));
9313 __Pyx_GIVEREF(__pyx_t_1);
9314 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
9315 __Pyx_GIVEREF(__pyx_t_2);
9316 PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
9319 __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 228, __pyx_L1_error)
9320 __Pyx_GOTREF(__pyx_t_2);
9321 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9322 __pyx_r = __pyx_t_2;
9336 __Pyx_XDECREF(__pyx_t_1);
9337 __Pyx_XDECREF(__pyx_t_2);
9338 __Pyx_XDECREF(__pyx_t_3);
9339 __Pyx_AddTraceback(
"View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
9342 __Pyx_XGIVEREF(__pyx_r);
9343 __Pyx_RefNannyFinishContext();
9356 static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self);
9357 static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) {
9359 __Pyx_RefNannyDeclarations
9360 __Pyx_RefNannySetupContext(
"__len__ (wrapper)", 0);
9361 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((
struct __pyx_array_obj *)__pyx_v_self));
9364 __Pyx_RefNannyFinishContext();
9368 static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(
struct __pyx_array_obj *__pyx_v_self) {
9370 __Pyx_RefNannyDeclarations
9371 __Pyx_RefNannySetupContext(
"__len__", 0);
9380 __pyx_r = (__pyx_v_self->_shape[0]);
9393 __Pyx_RefNannyFinishContext();
9406 static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr);
9407 static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) {
9408 PyObject *__pyx_r = 0;
9409 __Pyx_RefNannyDeclarations
9410 __Pyx_RefNannySetupContext(
"__getattr__ (wrapper)", 0);
9411 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((
struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr));
9414 __Pyx_RefNannyFinishContext();
9418 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) {
9419 PyObject *__pyx_r = NULL;
9420 __Pyx_RefNannyDeclarations
9421 PyObject *__pyx_t_1 = NULL;
9422 PyObject *__pyx_t_2 = NULL;
9423 int __pyx_lineno = 0;
9424 const char *__pyx_filename = NULL;
9425 int __pyx_clineno = 0;
9426 __Pyx_RefNannySetupContext(
"__getattr__", 0);
9435 __Pyx_XDECREF(__pyx_r);
9436 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 234, __pyx_L1_error)
9437 __Pyx_GOTREF(__pyx_t_1);
9438 __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 234, __pyx_L1_error)
9439 __Pyx_GOTREF(__pyx_t_2);
9440 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9441 __pyx_r = __pyx_t_2;
9455 __Pyx_XDECREF(__pyx_t_1);
9456 __Pyx_XDECREF(__pyx_t_2);
9457 __Pyx_AddTraceback(
"View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9460 __Pyx_XGIVEREF(__pyx_r);
9461 __Pyx_RefNannyFinishContext();
9474 static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item);
9475 static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
9476 PyObject *__pyx_r = 0;
9477 __Pyx_RefNannyDeclarations
9478 __Pyx_RefNannySetupContext(
"__getitem__ (wrapper)", 0);
9479 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((
struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item));
9482 __Pyx_RefNannyFinishContext();
9486 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) {
9487 PyObject *__pyx_r = NULL;
9488 __Pyx_RefNannyDeclarations
9489 PyObject *__pyx_t_1 = NULL;
9490 PyObject *__pyx_t_2 = NULL;
9491 int __pyx_lineno = 0;
9492 const char *__pyx_filename = NULL;
9493 int __pyx_clineno = 0;
9494 __Pyx_RefNannySetupContext(
"__getitem__", 0);
9503 __Pyx_XDECREF(__pyx_r);
9504 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 237, __pyx_L1_error)
9505 __Pyx_GOTREF(__pyx_t_1);
9506 __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 237, __pyx_L1_error)
9507 __Pyx_GOTREF(__pyx_t_2);
9508 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9509 __pyx_r = __pyx_t_2;
9523 __Pyx_XDECREF(__pyx_t_1);
9524 __Pyx_XDECREF(__pyx_t_2);
9525 __Pyx_AddTraceback(
"View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9528 __Pyx_XGIVEREF(__pyx_r);
9529 __Pyx_RefNannyFinishContext();
9542 static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value);
9543 static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
9545 __Pyx_RefNannyDeclarations
9546 __Pyx_RefNannySetupContext(
"__setitem__ (wrapper)", 0);
9547 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((
struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value));
9550 __Pyx_RefNannyFinishContext();
9554 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
9556 __Pyx_RefNannyDeclarations
9557 PyObject *__pyx_t_1 = NULL;
9558 int __pyx_lineno = 0;
9559 const char *__pyx_filename = NULL;
9560 int __pyx_clineno = 0;
9561 __Pyx_RefNannySetupContext(
"__setitem__", 0);
9570 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 240, __pyx_L1_error)
9571 __Pyx_GOTREF(__pyx_t_1);
9572 if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0)) __PYX_ERR(1, 240, __pyx_L1_error)
9573 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9587 __Pyx_XDECREF(__pyx_t_1);
9588 __Pyx_AddTraceback(
"View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9591 __Pyx_RefNannyFinishContext();
9602 static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
9603 static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
9604 PyObject *__pyx_r = 0;
9605 __Pyx_RefNannyDeclarations
9606 __Pyx_RefNannySetupContext(
"__reduce_cython__ (wrapper)", 0);
9607 __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((
struct __pyx_array_obj *)__pyx_v_self));
9610 __Pyx_RefNannyFinishContext();
9614 static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED
struct __pyx_array_obj *__pyx_v_self) {
9615 PyObject *__pyx_r = NULL;
9616 __Pyx_RefNannyDeclarations
9617 PyObject *__pyx_t_1 = NULL;
9618 int __pyx_lineno = 0;
9619 const char *__pyx_filename = NULL;
9620 int __pyx_clineno = 0;
9621 __Pyx_RefNannySetupContext(
"__reduce_cython__", 0);
9629 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__12, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
9630 __Pyx_GOTREF(__pyx_t_1);
9631 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
9632 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9633 __PYX_ERR(1, 2, __pyx_L1_error)
9643 __Pyx_XDECREF(__pyx_t_1);
9644 __Pyx_AddTraceback(
"View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9646 __Pyx_XGIVEREF(__pyx_r);
9647 __Pyx_RefNannyFinishContext();
9659 static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state);
9660 static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
9661 PyObject *__pyx_r = 0;
9662 __Pyx_RefNannyDeclarations
9663 __Pyx_RefNannySetupContext(
"__setstate_cython__ (wrapper)", 0);
9664 __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((
struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
9667 __Pyx_RefNannyFinishContext();
9671 static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
9672 PyObject *__pyx_r = NULL;
9673 __Pyx_RefNannyDeclarations
9674 PyObject *__pyx_t_1 = NULL;
9675 int __pyx_lineno = 0;
9676 const char *__pyx_filename = NULL;
9677 int __pyx_clineno = 0;
9678 __Pyx_RefNannySetupContext(
"__setstate_cython__", 0);
9685 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__13, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
9686 __Pyx_GOTREF(__pyx_t_1);
9687 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
9688 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
9689 __PYX_ERR(1, 4, __pyx_L1_error)
9700 __Pyx_XDECREF(__pyx_t_1);
9701 __Pyx_AddTraceback(
"View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9703 __Pyx_XGIVEREF(__pyx_r);
9704 __Pyx_RefNannyFinishContext();
9716 static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize,
char *__pyx_v_format,
char *__pyx_v_mode,
char *__pyx_v_buf) {
9717 struct __pyx_array_obj *__pyx_v_result = 0;
9718 struct __pyx_array_obj *__pyx_r = NULL;
9719 __Pyx_RefNannyDeclarations
9721 PyObject *__pyx_t_2 = NULL;
9722 PyObject *__pyx_t_3 = NULL;
9723 PyObject *__pyx_t_4 = NULL;
9724 PyObject *__pyx_t_5 = NULL;
9725 int __pyx_lineno = 0;
9726 const char *__pyx_filename = NULL;
9727 int __pyx_clineno = 0;
9728 __Pyx_RefNannySetupContext(
"array_cwrapper", 0);
9737 __pyx_t_1 = ((__pyx_v_buf == NULL) != 0);
9747 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 249, __pyx_L1_error)
9748 __Pyx_GOTREF(__pyx_t_2);
9749 __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 249, __pyx_L1_error)
9750 __Pyx_GOTREF(__pyx_t_3);
9751 __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 249, __pyx_L1_error)
9752 __Pyx_GOTREF(__pyx_t_4);
9753 __pyx_t_5 = PyTuple_New(4);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 249, __pyx_L1_error)
9754 __Pyx_GOTREF(__pyx_t_5);
9755 __Pyx_INCREF(__pyx_v_shape);
9756 __Pyx_GIVEREF(__pyx_v_shape);
9757 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_shape);
9758 __Pyx_GIVEREF(__pyx_t_2);
9759 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
9760 __Pyx_GIVEREF(__pyx_t_3);
9761 PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
9762 __Pyx_GIVEREF(__pyx_t_4);
9763 PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
9767 __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_5, NULL);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 249, __pyx_L1_error)
9768 __Pyx_GOTREF(__pyx_t_4);
9769 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
9770 __pyx_v_result = ((
struct __pyx_array_obj *)__pyx_t_4);
9791 __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 251, __pyx_L1_error)
9792 __Pyx_GOTREF(__pyx_t_4);
9793 __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 251, __pyx_L1_error)
9794 __Pyx_GOTREF(__pyx_t_5);
9795 __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 251, __pyx_L1_error)
9796 __Pyx_GOTREF(__pyx_t_3);
9797 __pyx_t_2 = PyTuple_New(4);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 251, __pyx_L1_error)
9798 __Pyx_GOTREF(__pyx_t_2);
9799 __Pyx_INCREF(__pyx_v_shape);
9800 __Pyx_GIVEREF(__pyx_v_shape);
9801 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape);
9802 __Pyx_GIVEREF(__pyx_t_4);
9803 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
9804 __Pyx_GIVEREF(__pyx_t_5);
9805 PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
9806 __Pyx_GIVEREF(__pyx_t_3);
9807 PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3);
9819 __pyx_t_3 = __Pyx_PyDict_NewPresized(1);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 252, __pyx_L1_error)
9820 __Pyx_GOTREF(__pyx_t_3);
9821 if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(1, 252, __pyx_L1_error)
9830 __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_2, __pyx_t_3);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 251, __pyx_L1_error)
9831 __Pyx_GOTREF(__pyx_t_5);
9832 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9833 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9834 __pyx_v_result = ((
struct __pyx_array_obj *)__pyx_t_5);
9844 __pyx_v_result->data = __pyx_v_buf;
9855 __Pyx_XDECREF(((PyObject *)__pyx_r));
9856 __Pyx_INCREF(((PyObject *)__pyx_v_result));
9857 __pyx_r = __pyx_v_result;
9870 __Pyx_XDECREF(__pyx_t_2);
9871 __Pyx_XDECREF(__pyx_t_3);
9872 __Pyx_XDECREF(__pyx_t_4);
9873 __Pyx_XDECREF(__pyx_t_5);
9874 __Pyx_AddTraceback(
"View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
9877 __Pyx_XDECREF((PyObject *)__pyx_v_result);
9878 __Pyx_XGIVEREF((PyObject *)__pyx_r);
9879 __Pyx_RefNannyFinishContext();
9892 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
9893 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
9894 PyObject *__pyx_v_name = 0;
9895 int __pyx_lineno = 0;
9896 const char *__pyx_filename = NULL;
9897 int __pyx_clineno = 0;
9899 __Pyx_RefNannyDeclarations
9900 __Pyx_RefNannySetupContext(
"__init__ (wrapper)", 0);
9902 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0};
9903 PyObject* values[1] = {0};
9904 if (unlikely(__pyx_kwds)) {
9906 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
9908 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9911 default:
goto __pyx_L5_argtuple_error;
9913 kw_args = PyDict_Size(__pyx_kwds);
9916 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
9917 else goto __pyx_L5_argtuple_error;
9919 if (unlikely(kw_args > 0)) {
9920 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__init__") < 0)) __PYX_ERR(1, 281, __pyx_L3_error)
9922 }
else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
9923 goto __pyx_L5_argtuple_error;
9925 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
9927 __pyx_v_name = values[0];
9929 goto __pyx_L4_argument_unpacking_done;
9930 __pyx_L5_argtuple_error:;
9931 __Pyx_RaiseArgtupleInvalid(
"__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 281, __pyx_L3_error)
9933 __Pyx_AddTraceback(
"View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9934 __Pyx_RefNannyFinishContext();
9936 __pyx_L4_argument_unpacking_done:;
9937 __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((
struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name);
9940 __Pyx_RefNannyFinishContext();
9944 static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(
struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) {
9946 __Pyx_RefNannyDeclarations
9947 __Pyx_RefNannySetupContext(
"__init__", 0);
9956 __Pyx_INCREF(__pyx_v_name);
9957 __Pyx_GIVEREF(__pyx_v_name);
9958 __Pyx_GOTREF(__pyx_v_self->name);
9959 __Pyx_DECREF(__pyx_v_self->name);
9960 __pyx_v_self->name = __pyx_v_name;
9972 __Pyx_RefNannyFinishContext();
9985 static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self);
9986 static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) {
9987 PyObject *__pyx_r = 0;
9988 __Pyx_RefNannyDeclarations
9989 __Pyx_RefNannySetupContext(
"__repr__ (wrapper)", 0);
9990 __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((
struct __pyx_MemviewEnum_obj *)__pyx_v_self));
9993 __Pyx_RefNannyFinishContext();
9997 static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(
struct __pyx_MemviewEnum_obj *__pyx_v_self) {
9998 PyObject *__pyx_r = NULL;
9999 __Pyx_RefNannyDeclarations
10000 __Pyx_RefNannySetupContext(
"__repr__", 0);
10009 __Pyx_XDECREF(__pyx_r);
10010 __Pyx_INCREF(__pyx_v_self->name);
10011 __pyx_r = __pyx_v_self->name;
10024 __Pyx_XGIVEREF(__pyx_r);
10025 __Pyx_RefNannyFinishContext();
10036 static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
10037 static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
10038 PyObject *__pyx_r = 0;
10039 __Pyx_RefNannyDeclarations
10040 __Pyx_RefNannySetupContext(
"__reduce_cython__ (wrapper)", 0);
10041 __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((
struct __pyx_MemviewEnum_obj *)__pyx_v_self));
10044 __Pyx_RefNannyFinishContext();
10048 static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(
struct __pyx_MemviewEnum_obj *__pyx_v_self) {
10049 PyObject *__pyx_v_state = 0;
10050 PyObject *__pyx_v__dict = 0;
10051 int __pyx_v_use_setstate;
10052 PyObject *__pyx_r = NULL;
10053 __Pyx_RefNannyDeclarations
10054 PyObject *__pyx_t_1 = NULL;
10057 PyObject *__pyx_t_4 = NULL;
10058 PyObject *__pyx_t_5 = NULL;
10059 int __pyx_lineno = 0;
10060 const char *__pyx_filename = NULL;
10061 int __pyx_clineno = 0;
10062 __Pyx_RefNannySetupContext(
"__reduce_cython__", 0);
10071 __pyx_t_1 = PyTuple_New(1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error)
10072 __Pyx_GOTREF(__pyx_t_1);
10073 __Pyx_INCREF(__pyx_v_self->name);
10074 __Pyx_GIVEREF(__pyx_v_self->name);
10075 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name);
10076 __pyx_v_state = ((PyObject*)__pyx_t_1);
10086 __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error)
10087 __Pyx_GOTREF(__pyx_t_1);
10088 __pyx_v__dict = __pyx_t_1;
10098 __pyx_t_2 = (__pyx_v__dict != Py_None);
10099 __pyx_t_3 = (__pyx_t_2 != 0);
10109 __pyx_t_1 = PyTuple_New(1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error)
10110 __Pyx_GOTREF(__pyx_t_1);
10111 __Pyx_INCREF(__pyx_v__dict);
10112 __Pyx_GIVEREF(__pyx_v__dict);
10113 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
10114 __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error)
10115 __Pyx_GOTREF(__pyx_t_4);
10116 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10117 __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
10127 __pyx_v_use_setstate = 1;
10147 __pyx_t_3 = (__pyx_v_self->name != Py_None);
10148 __pyx_v_use_setstate = __pyx_t_3;
10159 __pyx_t_3 = (__pyx_v_use_setstate != 0);
10169 __Pyx_XDECREF(__pyx_r);
10170 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error)
10171 __Pyx_GOTREF(__pyx_t_4);
10172 __pyx_t_1 = PyTuple_New(3);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error)
10173 __Pyx_GOTREF(__pyx_t_1);
10174 __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
10175 __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
10176 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
10177 __Pyx_INCREF(__pyx_int_184977713);
10178 __Pyx_GIVEREF(__pyx_int_184977713);
10179 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
10180 __Pyx_INCREF(Py_None);
10181 __Pyx_GIVEREF(Py_None);
10182 PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
10183 __pyx_t_5 = PyTuple_New(3);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error)
10184 __Pyx_GOTREF(__pyx_t_5);
10185 __Pyx_GIVEREF(__pyx_t_4);
10186 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
10187 __Pyx_GIVEREF(__pyx_t_1);
10188 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
10189 __Pyx_INCREF(__pyx_v_state);
10190 __Pyx_GIVEREF(__pyx_v_state);
10191 PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
10194 __pyx_r = __pyx_t_5;
10215 __Pyx_XDECREF(__pyx_r);
10216 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_Enum);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error)
10217 __Pyx_GOTREF(__pyx_t_5);
10218 __pyx_t_1 = PyTuple_New(3);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
10219 __Pyx_GOTREF(__pyx_t_1);
10220 __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
10221 __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
10222 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
10223 __Pyx_INCREF(__pyx_int_184977713);
10224 __Pyx_GIVEREF(__pyx_int_184977713);
10225 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
10226 __Pyx_INCREF(__pyx_v_state);
10227 __Pyx_GIVEREF(__pyx_v_state);
10228 PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
10229 __pyx_t_4 = PyTuple_New(2);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error)
10230 __Pyx_GOTREF(__pyx_t_4);
10231 __Pyx_GIVEREF(__pyx_t_5);
10232 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
10233 __Pyx_GIVEREF(__pyx_t_1);
10234 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
10237 __pyx_r = __pyx_t_4;
10250 __Pyx_XDECREF(__pyx_t_1);
10251 __Pyx_XDECREF(__pyx_t_4);
10252 __Pyx_XDECREF(__pyx_t_5);
10253 __Pyx_AddTraceback(
"View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10256 __Pyx_XDECREF(__pyx_v_state);
10257 __Pyx_XDECREF(__pyx_v__dict);
10258 __Pyx_XGIVEREF(__pyx_r);
10259 __Pyx_RefNannyFinishContext();
10271 static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state);
10272 static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
10273 PyObject *__pyx_r = 0;
10274 __Pyx_RefNannyDeclarations
10275 __Pyx_RefNannySetupContext(
"__setstate_cython__ (wrapper)", 0);
10276 __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((
struct __pyx_MemviewEnum_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
10279 __Pyx_RefNannyFinishContext();
10283 static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(
struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
10284 PyObject *__pyx_r = NULL;
10285 __Pyx_RefNannyDeclarations
10286 PyObject *__pyx_t_1 = NULL;
10287 int __pyx_lineno = 0;
10288 const char *__pyx_filename = NULL;
10289 int __pyx_clineno = 0;
10290 __Pyx_RefNannySetupContext(
"__setstate_cython__", 0);
10297 if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError,
"Expected %.16s, got %.200s",
"tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error)
10298 __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state));
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
10299 __Pyx_GOTREF(__pyx_t_1);
10300 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10310 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10313 __Pyx_XDECREF(__pyx_t_1);
10314 __Pyx_AddTraceback(
"View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10317 __Pyx_XGIVEREF(__pyx_r);
10318 __Pyx_RefNannyFinishContext();
10330 static void *__pyx_align_pointer(
void *__pyx_v_memory,
size_t __pyx_v_alignment) {
10331 Py_intptr_t __pyx_v_aligned_p;
10332 size_t __pyx_v_offset;
10343 __pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory);
10352 __pyx_v_offset = (__pyx_v_aligned_p % __pyx_v_alignment);
10361 __pyx_t_1 = ((__pyx_v_offset > 0) != 0);
10371 __pyx_v_aligned_p = (__pyx_v_aligned_p + (__pyx_v_alignment - __pyx_v_offset));
10389 __pyx_r = ((
void *)__pyx_v_aligned_p);
10414 static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
10415 static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
10416 PyObject *__pyx_v_obj = 0;
10418 int __pyx_v_dtype_is_object;
10419 int __pyx_lineno = 0;
10420 const char *__pyx_filename = NULL;
10421 int __pyx_clineno = 0;
10423 __Pyx_RefNannyDeclarations
10424 __Pyx_RefNannySetupContext(
"__cinit__ (wrapper)", 0);
10426 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0};
10427 PyObject* values[3] = {0,0,0};
10428 if (unlikely(__pyx_kwds)) {
10429 Py_ssize_t kw_args;
10430 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
10431 switch (pos_args) {
10432 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
10433 CYTHON_FALLTHROUGH;
10434 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
10435 CYTHON_FALLTHROUGH;
10436 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10437 CYTHON_FALLTHROUGH;
10439 default:
goto __pyx_L5_argtuple_error;
10441 kw_args = PyDict_Size(__pyx_kwds);
10442 switch (pos_args) {
10444 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--;
10445 else goto __pyx_L5_argtuple_error;
10446 CYTHON_FALLTHROUGH;
10448 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--;
10450 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 0, 2, 3, 1); __PYX_ERR(1, 345, __pyx_L3_error)
10452 CYTHON_FALLTHROUGH;
10455 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtype_is_object);
10456 if (value) { values[2] = value; kw_args--; }
10459 if (unlikely(kw_args > 0)) {
10460 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__cinit__") < 0)) __PYX_ERR(1, 345, __pyx_L3_error)
10463 switch (PyTuple_GET_SIZE(__pyx_args)) {
10464 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
10465 CYTHON_FALLTHROUGH;
10466 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
10467 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
10469 default:
goto __pyx_L5_argtuple_error;
10472 __pyx_v_obj = values[0];
10473 __pyx_v_flags = __Pyx_PyInt_As_int(values[1]);
if (unlikely((__pyx_v_flags == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 345, __pyx_L3_error)
10475 __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]);
if (unlikely((__pyx_v_dtype_is_object == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 345, __pyx_L3_error)
10477 __pyx_v_dtype_is_object = ((int)0);
10480 goto __pyx_L4_argument_unpacking_done;
10481 __pyx_L5_argtuple_error:;
10482 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 345, __pyx_L3_error)
10484 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10485 __Pyx_RefNannyFinishContext();
10487 __pyx_L4_argument_unpacking_done:;
10488 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((
struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object);
10491 __Pyx_RefNannyFinishContext();
10495 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj,
int __pyx_v_flags,
int __pyx_v_dtype_is_object) {
10497 __Pyx_RefNannyDeclarations
10502 int __pyx_lineno = 0;
10503 const char *__pyx_filename = NULL;
10504 int __pyx_clineno = 0;
10505 __Pyx_RefNannySetupContext(
"__cinit__", 0);
10514 __Pyx_INCREF(__pyx_v_obj);
10515 __Pyx_GIVEREF(__pyx_v_obj);
10516 __Pyx_GOTREF(__pyx_v_self->obj);
10517 __Pyx_DECREF(__pyx_v_self->obj);
10518 __pyx_v_self->obj = __pyx_v_obj;
10527 __pyx_v_self->flags = __pyx_v_flags;
10536 __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type));
10537 __pyx_t_3 = (__pyx_t_2 != 0);
10540 __pyx_t_1 = __pyx_t_3;
10541 goto __pyx_L4_bool_binop_done;
10543 __pyx_t_3 = (__pyx_v_obj != Py_None);
10544 __pyx_t_2 = (__pyx_t_3 != 0);
10545 __pyx_t_1 = __pyx_t_2;
10546 __pyx_L4_bool_binop_done:;
10556 __pyx_t_4 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags);
if (unlikely(__pyx_t_4 == ((
int)-1))) __PYX_ERR(1, 349, __pyx_L1_error)
10565 __pyx_t_1 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0);
10575 ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None;
10584 Py_INCREF(Py_None);
10611 __pyx_t_1 = ((__pyx_memoryview_thread_locks_used < 8) != 0);
10621 __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
10630 __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1);
10648 __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
10658 __pyx_v_self->lock = PyThread_allocate_lock();
10667 __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
10668 if (unlikely(__pyx_t_1)) {
10677 PyErr_NoMemory(); __PYX_ERR(1, 361, __pyx_L1_error)
10704 __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
10714 __pyx_t_2 = (((__pyx_v_self->view.format[0]) ==
'O') != 0);
10717 __pyx_t_1 = __pyx_t_2;
10718 goto __pyx_L11_bool_binop_done;
10720 __pyx_t_2 = (((__pyx_v_self->view.format[1]) ==
'\x00') != 0);
10721 __pyx_t_1 = __pyx_t_2;
10722 __pyx_L11_bool_binop_done:;
10723 __pyx_v_self->dtype_is_object = __pyx_t_1;
10743 __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object;
10754 __pyx_v_self->acquisition_count_aligned_p = ((__pyx_atomic_int *)__pyx_align_pointer(((
void *)(&(__pyx_v_self->acquisition_count[0]))), (
sizeof(__pyx_atomic_int))));
10763 __pyx_v_self->typeinfo = NULL;
10777 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
10780 __Pyx_RefNannyFinishContext();
10793 static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self);
10794 static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
10795 __Pyx_RefNannyDeclarations
10796 __Pyx_RefNannySetupContext(
"__dealloc__ (wrapper)", 0);
10797 __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
10800 __Pyx_RefNannyFinishContext();
10803 static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(
struct __pyx_memoryview_obj *__pyx_v_self) {
10805 __Pyx_RefNannyDeclarations
10811 PyThread_type_lock __pyx_t_6;
10812 PyThread_type_lock __pyx_t_7;
10813 __Pyx_RefNannySetupContext(
"__dealloc__", 0);
10822 __pyx_t_1 = (__pyx_v_self->obj != Py_None);
10823 __pyx_t_2 = (__pyx_t_1 != 0);
10833 __Pyx_ReleaseBuffer((&__pyx_v_self->view));
10852 __pyx_t_2 = ((((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None) != 0);
10862 ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL;
10871 Py_DECREF(Py_None);
10890 __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0);
10900 __pyx_t_3 = __pyx_memoryview_thread_locks_used;
10901 __pyx_t_4 = __pyx_t_3;
10902 for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
10903 __pyx_v_i = __pyx_t_5;
10912 __pyx_t_2 = (((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock) != 0);
10922 __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1);
10931 __pyx_t_2 = ((__pyx_v_i != __pyx_memoryview_thread_locks_used) != 0);
10941 __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
10942 __pyx_t_7 = (__pyx_memoryview_thread_locks[__pyx_v_i]);
10951 (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_6;
10952 (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_7;
10970 goto __pyx_L6_break;
10990 PyThread_free_lock(__pyx_v_self->lock);
11012 __Pyx_RefNannyFinishContext();
11023 static char *__pyx_memoryview_get_item_pointer(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
11024 Py_ssize_t __pyx_v_dim;
11025 char *__pyx_v_itemp;
11026 PyObject *__pyx_v_idx = NULL;
11028 __Pyx_RefNannyDeclarations
11029 Py_ssize_t __pyx_t_1;
11030 PyObject *__pyx_t_2 = NULL;
11031 Py_ssize_t __pyx_t_3;
11032 PyObject *(*__pyx_t_4)(PyObject *);
11033 PyObject *__pyx_t_5 = NULL;
11034 Py_ssize_t __pyx_t_6;
11036 int __pyx_lineno = 0;
11037 const char *__pyx_filename = NULL;
11038 int __pyx_clineno = 0;
11039 __Pyx_RefNannySetupContext(
"get_item_pointer", 0);
11048 __pyx_v_itemp = ((
char *)__pyx_v_self->view.buf);
11058 if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) {
11059 __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
11062 __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 397, __pyx_L1_error)
11063 __Pyx_GOTREF(__pyx_t_2);
11064 __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext;
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 397, __pyx_L1_error)
11067 if (likely(!__pyx_t_4)) {
11068 if (likely(PyList_CheckExact(__pyx_t_2))) {
11069 if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2))
break;
11070 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
11071 __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++;
if (unlikely(0 < 0)) __PYX_ERR(1, 397, __pyx_L1_error)
11073 __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++;
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 397, __pyx_L1_error)
11074 __Pyx_GOTREF(__pyx_t_5);
11077 if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2))
break;
11078 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
11079 __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++;
if (unlikely(0 < 0)) __PYX_ERR(1, 397, __pyx_L1_error)
11081 __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++;
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 397, __pyx_L1_error)
11082 __Pyx_GOTREF(__pyx_t_5);
11086 __pyx_t_5 = __pyx_t_4(__pyx_t_2);
11087 if (unlikely(!__pyx_t_5)) {
11088 PyObject* exc_type = PyErr_Occurred();
11090 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
11091 else __PYX_ERR(1, 397, __pyx_L1_error)
11095 __Pyx_GOTREF(__pyx_t_5);
11097 __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5);
11099 __pyx_v_dim = __pyx_t_1;
11100 __pyx_t_1 = (__pyx_t_1 + 1);
11109 __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx);
if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 398, __pyx_L1_error)
11110 __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim);
if (unlikely(__pyx_t_7 == ((
char *)NULL))) __PYX_ERR(1, 398, __pyx_L1_error)
11111 __pyx_v_itemp = __pyx_t_7;
11121 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11130 __pyx_r = __pyx_v_itemp;
11143 __Pyx_XDECREF(__pyx_t_2);
11144 __Pyx_XDECREF(__pyx_t_5);
11145 __Pyx_AddTraceback(
"View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename);
11148 __Pyx_XDECREF(__pyx_v_idx);
11149 __Pyx_RefNannyFinishContext();
11162 static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index);
11163 static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
11164 PyObject *__pyx_r = 0;
11165 __Pyx_RefNannyDeclarations
11166 __Pyx_RefNannySetupContext(
"__getitem__ (wrapper)", 0);
11167 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((
struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index));
11170 __Pyx_RefNannyFinishContext();
11174 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
11175 PyObject *__pyx_v_have_slices = NULL;
11176 PyObject *__pyx_v_indices = NULL;
11177 char *__pyx_v_itemp;
11178 PyObject *__pyx_r = NULL;
11179 __Pyx_RefNannyDeclarations
11182 PyObject *__pyx_t_3 = NULL;
11183 PyObject *__pyx_t_4 = NULL;
11184 PyObject *__pyx_t_5 = NULL;
11186 int __pyx_lineno = 0;
11187 const char *__pyx_filename = NULL;
11188 int __pyx_clineno = 0;
11189 __Pyx_RefNannySetupContext(
"__getitem__", 0);
11198 __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
11199 __pyx_t_2 = (__pyx_t_1 != 0);
11209 __Pyx_XDECREF(__pyx_r);
11210 __Pyx_INCREF(((PyObject *)__pyx_v_self));
11211 __pyx_r = ((PyObject *)__pyx_v_self);
11230 __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 407, __pyx_L1_error)
11231 __Pyx_GOTREF(__pyx_t_3);
11232 if (likely(__pyx_t_3 != Py_None)) {
11233 PyObject* sequence = __pyx_t_3;
11234 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
11235 if (unlikely(size != 2)) {
11236 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
11237 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
11238 __PYX_ERR(1, 407, __pyx_L1_error)
11240 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
11241 __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
11242 __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
11243 __Pyx_INCREF(__pyx_t_4);
11244 __Pyx_INCREF(__pyx_t_5);
11246 __pyx_t_4 = PySequence_ITEM(sequence, 0);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 407, __pyx_L1_error)
11247 __Pyx_GOTREF(__pyx_t_4);
11248 __pyx_t_5 = PySequence_ITEM(sequence, 1);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 407, __pyx_L1_error)
11249 __Pyx_GOTREF(__pyx_t_5);
11251 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11253 __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 407, __pyx_L1_error)
11255 __pyx_v_have_slices = __pyx_t_4;
11257 __pyx_v_indices = __pyx_t_5;
11267 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices);
if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 410, __pyx_L1_error)
11277 __Pyx_XDECREF(__pyx_r);
11278 __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices));
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 411, __pyx_L1_error)
11279 __Pyx_GOTREF(__pyx_t_3);
11280 __pyx_r = __pyx_t_3;
11301 __pyx_t_6 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices);
if (unlikely(__pyx_t_6 == ((
char *)NULL))) __PYX_ERR(1, 413, __pyx_L1_error)
11302 __pyx_v_itemp = __pyx_t_6;
11311 __Pyx_XDECREF(__pyx_r);
11312 __pyx_t_3 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 414, __pyx_L1_error)
11313 __Pyx_GOTREF(__pyx_t_3);
11314 __pyx_r = __pyx_t_3;
11329 __Pyx_XDECREF(__pyx_t_3);
11330 __Pyx_XDECREF(__pyx_t_4);
11331 __Pyx_XDECREF(__pyx_t_5);
11332 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11335 __Pyx_XDECREF(__pyx_v_have_slices);
11336 __Pyx_XDECREF(__pyx_v_indices);
11337 __Pyx_XGIVEREF(__pyx_r);
11338 __Pyx_RefNannyFinishContext();
11351 static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value);
11352 static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
11354 __Pyx_RefNannyDeclarations
11355 __Pyx_RefNannySetupContext(
"__setitem__ (wrapper)", 0);
11356 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((
struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value));
11359 __Pyx_RefNannyFinishContext();
11363 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
11364 PyObject *__pyx_v_have_slices = NULL;
11365 PyObject *__pyx_v_obj = NULL;
11367 __Pyx_RefNannyDeclarations
11369 PyObject *__pyx_t_2 = NULL;
11370 PyObject *__pyx_t_3 = NULL;
11371 PyObject *__pyx_t_4 = NULL;
11372 int __pyx_lineno = 0;
11373 const char *__pyx_filename = NULL;
11374 int __pyx_clineno = 0;
11375 __Pyx_RefNannySetupContext(
"__setitem__", 0);
11376 __Pyx_INCREF(__pyx_v_index);
11385 __pyx_t_1 = (__pyx_v_self->view.readonly != 0);
11386 if (unlikely(__pyx_t_1)) {
11395 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__14, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 418, __pyx_L1_error)
11396 __Pyx_GOTREF(__pyx_t_2);
11397 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
11398 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11399 __PYX_ERR(1, 418, __pyx_L1_error)
11417 __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 420, __pyx_L1_error)
11418 __Pyx_GOTREF(__pyx_t_2);
11419 if (likely(__pyx_t_2 != Py_None)) {
11420 PyObject* sequence = __pyx_t_2;
11421 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
11422 if (unlikely(size != 2)) {
11423 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
11424 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
11425 __PYX_ERR(1, 420, __pyx_L1_error)
11427 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
11428 __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
11429 __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
11430 __Pyx_INCREF(__pyx_t_3);
11431 __Pyx_INCREF(__pyx_t_4);
11433 __pyx_t_3 = PySequence_ITEM(sequence, 0);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 420, __pyx_L1_error)
11434 __Pyx_GOTREF(__pyx_t_3);
11435 __pyx_t_4 = PySequence_ITEM(sequence, 1);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 420, __pyx_L1_error)
11436 __Pyx_GOTREF(__pyx_t_4);
11438 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11440 __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 420, __pyx_L1_error)
11442 __pyx_v_have_slices = __pyx_t_3;
11444 __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_4);
11454 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 422, __pyx_L1_error)
11464 __pyx_t_2 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 423, __pyx_L1_error)
11465 __Pyx_GOTREF(__pyx_t_2);
11466 __pyx_v_obj = __pyx_t_2;
11476 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_obj);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 424, __pyx_L1_error)
11486 __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 425, __pyx_L1_error)
11487 __Pyx_GOTREF(__pyx_t_2);
11488 __pyx_t_4 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_2, __pyx_v_obj);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 425, __pyx_L1_error)
11489 __Pyx_GOTREF(__pyx_t_4);
11490 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11491 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11511 __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 427, __pyx_L1_error)
11512 __Pyx_GOTREF(__pyx_t_4);
11513 if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_memoryview_type))))) __PYX_ERR(1, 427, __pyx_L1_error)
11514 __pyx_t_2 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((
struct __pyx_memoryview_obj *)__pyx_t_4), __pyx_v_value);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 427, __pyx_L1_error)
11515 __Pyx_GOTREF(__pyx_t_2);
11516 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
11517 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11539 __pyx_t_2 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 429, __pyx_L1_error)
11540 __Pyx_GOTREF(__pyx_t_2);
11541 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11557 __Pyx_XDECREF(__pyx_t_2);
11558 __Pyx_XDECREF(__pyx_t_3);
11559 __Pyx_XDECREF(__pyx_t_4);
11560 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11563 __Pyx_XDECREF(__pyx_v_have_slices);
11564 __Pyx_XDECREF(__pyx_v_obj);
11565 __Pyx_XDECREF(__pyx_v_index);
11566 __Pyx_RefNannyFinishContext();
11578 static PyObject *__pyx_memoryview_is_slice(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) {
11579 PyObject *__pyx_r = NULL;
11580 __Pyx_RefNannyDeclarations
11583 PyObject *__pyx_t_3 = NULL;
11584 PyObject *__pyx_t_4 = NULL;
11585 PyObject *__pyx_t_5 = NULL;
11586 PyObject *__pyx_t_6 = NULL;
11587 PyObject *__pyx_t_7 = NULL;
11588 PyObject *__pyx_t_8 = NULL;
11590 int __pyx_lineno = 0;
11591 const char *__pyx_filename = NULL;
11592 int __pyx_clineno = 0;
11593 __Pyx_RefNannySetupContext(
"is_slice", 0);
11594 __Pyx_INCREF(__pyx_v_obj);
11603 __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type);
11604 __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
11615 __Pyx_PyThreadState_declare
11616 __Pyx_PyThreadState_assign
11617 __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
11618 __Pyx_XGOTREF(__pyx_t_3);
11619 __Pyx_XGOTREF(__pyx_t_4);
11620 __Pyx_XGOTREF(__pyx_t_5);
11630 __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS));
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 434, __pyx_L4_error)
11631 __Pyx_GOTREF(__pyx_t_6);
11640 __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object);
if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 435, __pyx_L4_error)
11641 __Pyx_GOTREF(__pyx_t_7);
11650 __pyx_t_8 = PyTuple_New(3);
if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 434, __pyx_L4_error)
11651 __Pyx_GOTREF(__pyx_t_8);
11652 __Pyx_INCREF(__pyx_v_obj);
11653 __Pyx_GIVEREF(__pyx_v_obj);
11654 PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj);
11655 __Pyx_GIVEREF(__pyx_t_6);
11656 PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
11657 __Pyx_GIVEREF(__pyx_t_7);
11658 PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
11661 __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL);
if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 434, __pyx_L4_error)
11662 __Pyx_GOTREF(__pyx_t_7);
11663 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
11664 __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7);
11675 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
11676 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
11677 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
11678 goto __pyx_L9_try_end;
11680 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
11681 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
11682 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
11691 __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
11693 __Pyx_AddTraceback(
"View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
11694 if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(1, 436, __pyx_L6_except_error)
11695 __Pyx_GOTREF(__pyx_t_7);
11696 __Pyx_GOTREF(__pyx_t_8);
11697 __Pyx_GOTREF(__pyx_t_6);
11706 __Pyx_XDECREF(__pyx_r);
11707 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
11708 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11709 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
11710 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
11711 goto __pyx_L7_except_return;
11713 goto __pyx_L6_except_error;
11714 __pyx_L6_except_error:;
11723 __Pyx_XGIVEREF(__pyx_t_3);
11724 __Pyx_XGIVEREF(__pyx_t_4);
11725 __Pyx_XGIVEREF(__pyx_t_5);
11726 __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
11727 goto __pyx_L1_error;
11728 __pyx_L7_except_return:;
11729 __Pyx_XGIVEREF(__pyx_t_3);
11730 __Pyx_XGIVEREF(__pyx_t_4);
11731 __Pyx_XGIVEREF(__pyx_t_5);
11732 __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
11753 __Pyx_XDECREF(__pyx_r);
11754 __Pyx_INCREF(__pyx_v_obj);
11755 __pyx_r = __pyx_v_obj;
11768 __Pyx_XDECREF(__pyx_t_6);
11769 __Pyx_XDECREF(__pyx_t_7);
11770 __Pyx_XDECREF(__pyx_t_8);
11771 __Pyx_AddTraceback(
"View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
11774 __Pyx_XDECREF(__pyx_v_obj);
11775 __Pyx_XGIVEREF(__pyx_r);
11776 __Pyx_RefNannyFinishContext();
11788 static PyObject *__pyx_memoryview_setitem_slice_assignment(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) {
11789 __Pyx_memviewslice __pyx_v_dst_slice;
11790 __Pyx_memviewslice __pyx_v_src_slice;
11791 PyObject *__pyx_r = NULL;
11792 __Pyx_RefNannyDeclarations
11793 __Pyx_memviewslice *__pyx_t_1;
11794 __Pyx_memviewslice *__pyx_t_2;
11795 PyObject *__pyx_t_3 = NULL;
11799 int __pyx_lineno = 0;
11800 const char *__pyx_filename = NULL;
11801 int __pyx_clineno = 0;
11802 __Pyx_RefNannySetupContext(
"setitem_slice_assignment", 0);
11811 if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(1, 445, __pyx_L1_error)
11812 __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((
struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice));
if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 445, __pyx_L1_error)
11821 if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(1, 446, __pyx_L1_error)
11822 __pyx_t_2 = __pyx_memoryview_get_slice_from_memoryview(((
struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice));
if (unlikely(__pyx_t_2 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 446, __pyx_L1_error)
11831 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 447, __pyx_L1_error)
11832 __Pyx_GOTREF(__pyx_t_3);
11833 __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3);
if (unlikely((__pyx_t_4 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 447, __pyx_L1_error)
11834 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11835 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 447, __pyx_L1_error)
11836 __Pyx_GOTREF(__pyx_t_3);
11837 __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3);
if (unlikely((__pyx_t_5 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(1, 447, __pyx_L1_error)
11838 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11847 __pyx_t_6 = __pyx_memoryview_copy_contents((__pyx_t_1[0]), (__pyx_t_2[0]), __pyx_t_4, __pyx_t_5, __pyx_v_self->dtype_is_object);
if (unlikely(__pyx_t_6 == ((
int)-1))) __PYX_ERR(1, 445, __pyx_L1_error)
11858 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
11861 __Pyx_XDECREF(__pyx_t_3);
11862 __Pyx_AddTraceback(
"View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
11865 __Pyx_XGIVEREF(__pyx_r);
11866 __Pyx_RefNannyFinishContext();
11878 static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(
struct __pyx_memoryview_obj *__pyx_v_self,
struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) {
11879 int __pyx_v_array[0x80];
11881 void *__pyx_v_item;
11882 __Pyx_memviewslice *__pyx_v_dst_slice;
11883 __Pyx_memviewslice __pyx_v_tmp_slice;
11884 PyObject *__pyx_r = NULL;
11885 __Pyx_RefNannyDeclarations
11886 __Pyx_memviewslice *__pyx_t_1;
11888 PyObject *__pyx_t_3 = NULL;
11891 char const *__pyx_t_6;
11892 PyObject *__pyx_t_7 = NULL;
11893 PyObject *__pyx_t_8 = NULL;
11894 PyObject *__pyx_t_9 = NULL;
11895 PyObject *__pyx_t_10 = NULL;
11896 PyObject *__pyx_t_11 = NULL;
11897 PyObject *__pyx_t_12 = NULL;
11898 int __pyx_lineno = 0;
11899 const char *__pyx_filename = NULL;
11900 int __pyx_clineno = 0;
11901 __Pyx_RefNannySetupContext(
"setitem_slice_assign_scalar", 0);
11910 __pyx_v_tmp = NULL;
11919 __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice));
if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 456, __pyx_L1_error)
11920 __pyx_v_dst_slice = __pyx_t_1;
11929 __pyx_t_2 = ((((size_t)__pyx_v_self->view.itemsize) > (
sizeof(__pyx_v_array))) != 0);
11939 __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize);
11948 __pyx_t_2 = ((__pyx_v_tmp == NULL) != 0);
11949 if (unlikely(__pyx_t_2)) {
11958 PyErr_NoMemory(); __PYX_ERR(1, 461, __pyx_L1_error)
11976 __pyx_v_item = __pyx_v_tmp;
11996 __pyx_v_item = ((
void *)__pyx_v_array);
12016 __pyx_t_2 = (__pyx_v_self->dtype_is_object != 0);
12026 (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value);
12046 __pyx_t_3 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((
char *)__pyx_v_item), __pyx_v_value);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 470, __pyx_L6_error)
12047 __Pyx_GOTREF(__pyx_t_3);
12048 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12059 __pyx_t_2 = ((__pyx_v_self->view.suboffsets != NULL) != 0);
12069 __pyx_t_3 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 475, __pyx_L6_error)
12070 __Pyx_GOTREF(__pyx_t_3);
12071 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12089 __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object);
12101 PyMem_Free(__pyx_v_tmp);
12106 __Pyx_PyThreadState_declare
12107 __Pyx_PyThreadState_assign
12108 __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
12109 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
12110 if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
12111 if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
12112 __Pyx_XGOTREF(__pyx_t_7);
12113 __Pyx_XGOTREF(__pyx_t_8);
12114 __Pyx_XGOTREF(__pyx_t_9);
12115 __Pyx_XGOTREF(__pyx_t_10);
12116 __Pyx_XGOTREF(__pyx_t_11);
12117 __Pyx_XGOTREF(__pyx_t_12);
12118 __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
12120 PyMem_Free(__pyx_v_tmp);
12122 if (PY_MAJOR_VERSION >= 3) {
12123 __Pyx_XGIVEREF(__pyx_t_10);
12124 __Pyx_XGIVEREF(__pyx_t_11);
12125 __Pyx_XGIVEREF(__pyx_t_12);
12126 __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
12128 __Pyx_XGIVEREF(__pyx_t_7);
12129 __Pyx_XGIVEREF(__pyx_t_8);
12130 __Pyx_XGIVEREF(__pyx_t_9);
12131 __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
12132 __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
12133 __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
12134 goto __pyx_L1_error;
12148 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
12151 __Pyx_XDECREF(__pyx_t_3);
12152 __Pyx_AddTraceback(
"View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
12155 __Pyx_XGIVEREF(__pyx_r);
12156 __Pyx_RefNannyFinishContext();
12168 static PyObject *__pyx_memoryview_setitem_indexed(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
12169 char *__pyx_v_itemp;
12170 PyObject *__pyx_r = NULL;
12171 __Pyx_RefNannyDeclarations
12173 PyObject *__pyx_t_2 = NULL;
12174 int __pyx_lineno = 0;
12175 const char *__pyx_filename = NULL;
12176 int __pyx_clineno = 0;
12177 __Pyx_RefNannySetupContext(
"setitem_indexed", 0);
12186 __pyx_t_1 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index);
if (unlikely(__pyx_t_1 == ((
char *)NULL))) __PYX_ERR(1, 482, __pyx_L1_error)
12187 __pyx_v_itemp = __pyx_t_1;
12196 __pyx_t_2 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 483, __pyx_L1_error)
12197 __Pyx_GOTREF(__pyx_t_2);
12198 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12209 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
12212 __Pyx_XDECREF(__pyx_t_2);
12213 __Pyx_AddTraceback(
"View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename);
12216 __Pyx_XGIVEREF(__pyx_r);
12217 __Pyx_RefNannyFinishContext();
12229 static PyObject *__pyx_memoryview_convert_item_to_object(
struct __pyx_memoryview_obj *__pyx_v_self,
char *__pyx_v_itemp) {
12230 PyObject *__pyx_v_struct = NULL;
12231 PyObject *__pyx_v_bytesitem = 0;
12232 PyObject *__pyx_v_result = NULL;
12233 PyObject *__pyx_r = NULL;
12234 __Pyx_RefNannyDeclarations
12235 PyObject *__pyx_t_1 = NULL;
12236 PyObject *__pyx_t_2 = NULL;
12237 PyObject *__pyx_t_3 = NULL;
12238 PyObject *__pyx_t_4 = NULL;
12239 PyObject *__pyx_t_5 = NULL;
12240 PyObject *__pyx_t_6 = NULL;
12241 PyObject *__pyx_t_7 = NULL;
12243 PyObject *__pyx_t_9 = NULL;
12246 int __pyx_lineno = 0;
12247 const char *__pyx_filename = NULL;
12248 int __pyx_clineno = 0;
12249 __Pyx_RefNannySetupContext(
"convert_item_to_object", 0);
12258 __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 488, __pyx_L1_error)
12259 __Pyx_GOTREF(__pyx_t_1);
12260 __pyx_v_struct = __pyx_t_1;
12270 __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 491, __pyx_L1_error)
12271 __Pyx_GOTREF(__pyx_t_1);
12272 __pyx_v_bytesitem = ((PyObject*)__pyx_t_1);
12283 __Pyx_PyThreadState_declare
12284 __Pyx_PyThreadState_assign
12285 __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
12286 __Pyx_XGOTREF(__pyx_t_2);
12287 __Pyx_XGOTREF(__pyx_t_3);
12288 __Pyx_XGOTREF(__pyx_t_4);
12298 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 493, __pyx_L3_error)
12299 __Pyx_GOTREF(__pyx_t_5);
12300 __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 493, __pyx_L3_error)
12301 __Pyx_GOTREF(__pyx_t_6);
12304 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
12305 __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
12306 if (likely(__pyx_t_7)) {
12307 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_5);
12308 __Pyx_INCREF(__pyx_t_7);
12309 __Pyx_INCREF(
function);
12310 __Pyx_DECREF_SET(__pyx_t_5,
function);
12314 #if CYTHON_FAST_PYCALL
12315 if (PyFunction_Check(__pyx_t_5)) {
12316 PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
12317 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 493, __pyx_L3_error)
12318 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
12319 __Pyx_GOTREF(__pyx_t_1);
12320 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
12323 #if CYTHON_FAST_PYCCALL
12324 if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
12325 PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
12326 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 493, __pyx_L3_error)
12327 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
12328 __Pyx_GOTREF(__pyx_t_1);
12329 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
12333 __pyx_t_9 = PyTuple_New(2+__pyx_t_8);
if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 493, __pyx_L3_error)
12334 __Pyx_GOTREF(__pyx_t_9);
12336 __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
12338 __Pyx_GIVEREF(__pyx_t_6);
12339 PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6);
12340 __Pyx_INCREF(__pyx_v_bytesitem);
12341 __Pyx_GIVEREF(__pyx_v_bytesitem);
12342 PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_bytesitem);
12344 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 493, __pyx_L3_error)
12345 __Pyx_GOTREF(__pyx_t_1);
12346 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
12348 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12349 __pyx_v_result = __pyx_t_1;
12369 __pyx_t_10 = strlen(__pyx_v_self->view.format);
12370 __pyx_t_11 = ((__pyx_t_10 == 1) != 0);
12380 __Pyx_XDECREF(__pyx_r);
12381 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0,
long, 1, __Pyx_PyInt_From_long, 0, 0, 1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 498, __pyx_L5_except_error)
12382 __Pyx_GOTREF(__pyx_t_1);
12383 __pyx_r = __pyx_t_1;
12385 goto __pyx_L6_except_return;
12403 __Pyx_XDECREF(__pyx_r);
12404 __Pyx_INCREF(__pyx_v_result);
12405 __pyx_r = __pyx_v_result;
12406 goto __pyx_L6_except_return;
12409 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
12410 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
12411 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
12412 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
12413 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
12422 __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9);
12423 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 494, __pyx_L5_except_error)
12424 __Pyx_GOTREF(__pyx_t_6);
12425 __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6);
12426 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
12427 __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_9);
12428 __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_9 = 0;
12430 __Pyx_AddTraceback(
"View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
12431 if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(1, 494, __pyx_L5_except_error)
12432 __Pyx_GOTREF(__pyx_t_9);
12433 __Pyx_GOTREF(__pyx_t_5);
12434 __Pyx_GOTREF(__pyx_t_1);
12443 __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__15, NULL);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 495, __pyx_L5_except_error)
12444 __Pyx_GOTREF(__pyx_t_6);
12445 __Pyx_Raise(__pyx_t_6, 0, 0, 0);
12446 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
12447 __PYX_ERR(1, 495, __pyx_L5_except_error)
12449 goto __pyx_L5_except_error;
12450 __pyx_L5_except_error:;
12459 __Pyx_XGIVEREF(__pyx_t_2);
12460 __Pyx_XGIVEREF(__pyx_t_3);
12461 __Pyx_XGIVEREF(__pyx_t_4);
12462 __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
12463 goto __pyx_L1_error;
12464 __pyx_L6_except_return:;
12465 __Pyx_XGIVEREF(__pyx_t_2);
12466 __Pyx_XGIVEREF(__pyx_t_3);
12467 __Pyx_XGIVEREF(__pyx_t_4);
12468 __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
12482 __Pyx_XDECREF(__pyx_t_1);
12483 __Pyx_XDECREF(__pyx_t_5);
12484 __Pyx_XDECREF(__pyx_t_6);
12485 __Pyx_XDECREF(__pyx_t_7);
12486 __Pyx_XDECREF(__pyx_t_9);
12487 __Pyx_AddTraceback(
"View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
12490 __Pyx_XDECREF(__pyx_v_struct);
12491 __Pyx_XDECREF(__pyx_v_bytesitem);
12492 __Pyx_XDECREF(__pyx_v_result);
12493 __Pyx_XGIVEREF(__pyx_r);
12494 __Pyx_RefNannyFinishContext();
12506 static PyObject *__pyx_memoryview_assign_item_from_object(
struct __pyx_memoryview_obj *__pyx_v_self,
char *__pyx_v_itemp, PyObject *__pyx_v_value) {
12507 PyObject *__pyx_v_struct = NULL;
12509 PyObject *__pyx_v_bytesvalue = 0;
12510 Py_ssize_t __pyx_v_i;
12511 PyObject *__pyx_r = NULL;
12512 __Pyx_RefNannyDeclarations
12513 PyObject *__pyx_t_1 = NULL;
12516 PyObject *__pyx_t_4 = NULL;
12517 PyObject *__pyx_t_5 = NULL;
12518 PyObject *__pyx_t_6 = NULL;
12520 PyObject *__pyx_t_8 = NULL;
12521 Py_ssize_t __pyx_t_9;
12522 PyObject *__pyx_t_10 = NULL;
12527 int __pyx_lineno = 0;
12528 const char *__pyx_filename = NULL;
12529 int __pyx_clineno = 0;
12530 __Pyx_RefNannySetupContext(
"assign_item_from_object", 0);
12539 __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 504, __pyx_L1_error)
12540 __Pyx_GOTREF(__pyx_t_1);
12541 __pyx_v_struct = __pyx_t_1;
12551 __pyx_t_2 = PyTuple_Check(__pyx_v_value);
12552 __pyx_t_3 = (__pyx_t_2 != 0);
12562 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 510, __pyx_L1_error)
12563 __Pyx_GOTREF(__pyx_t_1);
12564 __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 510, __pyx_L1_error)
12565 __Pyx_GOTREF(__pyx_t_4);
12566 __pyx_t_5 = PyTuple_New(1);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 510, __pyx_L1_error)
12567 __Pyx_GOTREF(__pyx_t_5);
12568 __Pyx_GIVEREF(__pyx_t_4);
12569 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
12571 __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 510, __pyx_L1_error)
12572 __Pyx_GOTREF(__pyx_t_4);
12573 __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 510, __pyx_L1_error)
12574 __Pyx_GOTREF(__pyx_t_6);
12575 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
12576 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
12577 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 510, __pyx_L1_error)
12578 __Pyx_GOTREF(__pyx_t_4);
12579 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12580 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
12581 if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError,
"Expected %.16s, got %.200s",
"bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(1, 510, __pyx_L1_error)
12582 __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
12603 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 512, __pyx_L1_error)
12604 __Pyx_GOTREF(__pyx_t_6);
12605 __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 512, __pyx_L1_error)
12606 __Pyx_GOTREF(__pyx_t_1);
12609 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
12610 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
12611 if (likely(__pyx_t_5)) {
12612 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_6);
12613 __Pyx_INCREF(__pyx_t_5);
12614 __Pyx_INCREF(
function);
12615 __Pyx_DECREF_SET(__pyx_t_6,
function);
12619 #if CYTHON_FAST_PYCALL
12620 if (PyFunction_Check(__pyx_t_6)) {
12621 PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
12622 __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 512, __pyx_L1_error)
12623 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
12624 __Pyx_GOTREF(__pyx_t_4);
12625 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12628 #if CYTHON_FAST_PYCCALL
12629 if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
12630 PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
12631 __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 512, __pyx_L1_error)
12632 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
12633 __Pyx_GOTREF(__pyx_t_4);
12634 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12638 __pyx_t_8 = PyTuple_New(2+__pyx_t_7);
if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 512, __pyx_L1_error)
12639 __Pyx_GOTREF(__pyx_t_8);
12641 __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
12643 __Pyx_GIVEREF(__pyx_t_1);
12644 PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_1);
12645 __Pyx_INCREF(__pyx_v_value);
12646 __Pyx_GIVEREF(__pyx_v_value);
12647 PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_value);
12649 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 512, __pyx_L1_error)
12650 __Pyx_GOTREF(__pyx_t_4);
12651 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
12653 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
12654 if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError,
"Expected %.16s, got %.200s",
"bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(1, 512, __pyx_L1_error)
12655 __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
12668 if (unlikely(__pyx_v_bytesvalue == Py_None)) {
12669 PyErr_SetString(PyExc_TypeError,
"'NoneType' is not iterable");
12670 __PYX_ERR(1, 514, __pyx_L1_error)
12672 __Pyx_INCREF(__pyx_v_bytesvalue);
12673 __pyx_t_10 = __pyx_v_bytesvalue;
12674 __pyx_t_12 = PyBytes_AS_STRING(__pyx_t_10);
12675 __pyx_t_13 = (__pyx_t_12 + PyBytes_GET_SIZE(__pyx_t_10));
12676 for (__pyx_t_14 = __pyx_t_12; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) {
12677 __pyx_t_11 = __pyx_t_14;
12678 __pyx_v_c = (__pyx_t_11[0]);
12687 __pyx_v_i = __pyx_t_9;
12696 __pyx_t_9 = (__pyx_t_9 + 1);
12705 (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
12707 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
12718 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
12721 __Pyx_XDECREF(__pyx_t_1);
12722 __Pyx_XDECREF(__pyx_t_4);
12723 __Pyx_XDECREF(__pyx_t_5);
12724 __Pyx_XDECREF(__pyx_t_6);
12725 __Pyx_XDECREF(__pyx_t_8);
12726 __Pyx_XDECREF(__pyx_t_10);
12727 __Pyx_AddTraceback(
"View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
12730 __Pyx_XDECREF(__pyx_v_struct);
12731 __Pyx_XDECREF(__pyx_v_bytesvalue);
12732 __Pyx_XGIVEREF(__pyx_r);
12733 __Pyx_RefNannyFinishContext();
12746 static CYTHON_UNUSED
int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
12747 static CYTHON_UNUSED
int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags) {
12749 __Pyx_RefNannyDeclarations
12750 __Pyx_RefNannySetupContext(
"__getbuffer__ (wrapper)", 0);
12751 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((
struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((
int)__pyx_v_flags));
12754 __Pyx_RefNannyFinishContext();
12758 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(
struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags) {
12760 __Pyx_RefNannyDeclarations
12763 PyObject *__pyx_t_3 = NULL;
12764 Py_ssize_t *__pyx_t_4;
12768 Py_ssize_t __pyx_t_8;
12769 int __pyx_lineno = 0;
12770 const char *__pyx_filename = NULL;
12771 int __pyx_clineno = 0;
12772 if (__pyx_v_info == NULL) {
12773 PyErr_SetString(PyExc_BufferError,
"PyObject_GetBuffer: view==NULL argument is obsolete");
12776 __Pyx_RefNannySetupContext(
"__getbuffer__", 0);
12777 __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
12778 __Pyx_GIVEREF(__pyx_v_info->obj);
12787 __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0);
12790 __pyx_t_1 = __pyx_t_2;
12791 goto __pyx_L4_bool_binop_done;
12793 __pyx_t_2 = (__pyx_v_self->view.readonly != 0);
12794 __pyx_t_1 = __pyx_t_2;
12795 __pyx_L4_bool_binop_done:;
12796 if (unlikely(__pyx_t_1)) {
12805 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__16, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 520, __pyx_L1_error)
12806 __Pyx_GOTREF(__pyx_t_3);
12807 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
12808 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12809 __PYX_ERR(1, 520, __pyx_L1_error)
12827 __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0);
12837 __pyx_t_4 = __pyx_v_self->view.shape;
12838 __pyx_v_info->shape = __pyx_t_4;
12858 __pyx_v_info->shape = NULL;
12869 __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
12879 __pyx_t_4 = __pyx_v_self->view.strides;
12880 __pyx_v_info->strides = __pyx_t_4;
12900 __pyx_v_info->strides = NULL;
12911 __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0);
12921 __pyx_t_4 = __pyx_v_self->view.suboffsets;
12922 __pyx_v_info->suboffsets = __pyx_t_4;
12942 __pyx_v_info->suboffsets = NULL;
12953 __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
12963 __pyx_t_5 = __pyx_v_self->view.format;
12964 __pyx_v_info->format = __pyx_t_5;
12984 __pyx_v_info->format = NULL;
12995 __pyx_t_6 = __pyx_v_self->view.buf;
12996 __pyx_v_info->buf = __pyx_t_6;
13005 __pyx_t_7 = __pyx_v_self->view.ndim;
13006 __pyx_v_info->ndim = __pyx_t_7;
13015 __pyx_t_8 = __pyx_v_self->view.itemsize;
13016 __pyx_v_info->itemsize = __pyx_t_8;
13025 __pyx_t_8 = __pyx_v_self->view.len;
13026 __pyx_v_info->len = __pyx_t_8;
13035 __pyx_t_1 = __pyx_v_self->view.readonly;
13036 __pyx_v_info->readonly = __pyx_t_1;
13045 __Pyx_INCREF(((PyObject *)__pyx_v_self));
13046 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
13047 __Pyx_GOTREF(__pyx_v_info->obj);
13048 __Pyx_DECREF(__pyx_v_info->obj);
13049 __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
13063 __Pyx_XDECREF(__pyx_t_3);
13064 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13066 if (__pyx_v_info->obj != NULL) {
13067 __Pyx_GOTREF(__pyx_v_info->obj);
13068 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
13072 if (__pyx_v_info->obj == Py_None) {
13073 __Pyx_GOTREF(__pyx_v_info->obj);
13074 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
13077 __Pyx_RefNannyFinishContext();
13090 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self);
13091 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) {
13092 PyObject *__pyx_r = 0;
13093 __Pyx_RefNannyDeclarations
13094 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
13095 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
13098 __Pyx_RefNannyFinishContext();
13102 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
13103 struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
13104 PyObject *__pyx_r = NULL;
13105 __Pyx_RefNannyDeclarations
13106 PyObject *__pyx_t_1 = NULL;
13108 int __pyx_lineno = 0;
13109 const char *__pyx_filename = NULL;
13110 int __pyx_clineno = 0;
13111 __Pyx_RefNannySetupContext(
"__get__", 0);
13120 __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 554, __pyx_L1_error)
13121 __Pyx_GOTREF(__pyx_t_1);
13122 if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(1, 554, __pyx_L1_error)
13123 __pyx_v_result = ((
struct __pyx_memoryviewslice_obj *)__pyx_t_1);
13133 __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice));
if (unlikely(__pyx_t_2 == ((
int)0))) __PYX_ERR(1, 555, __pyx_L1_error)
13142 __Pyx_XDECREF(__pyx_r);
13143 __Pyx_INCREF(((PyObject *)__pyx_v_result));
13144 __pyx_r = ((PyObject *)__pyx_v_result);
13157 __Pyx_XDECREF(__pyx_t_1);
13158 __Pyx_AddTraceback(
"View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13161 __Pyx_XDECREF((PyObject *)__pyx_v_result);
13162 __Pyx_XGIVEREF(__pyx_r);
13163 __Pyx_RefNannyFinishContext();
13176 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self);
13177 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) {
13178 PyObject *__pyx_r = 0;
13179 __Pyx_RefNannyDeclarations
13180 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
13181 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
13184 __Pyx_RefNannyFinishContext();
13188 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
13189 PyObject *__pyx_r = NULL;
13190 __Pyx_RefNannyDeclarations
13191 __Pyx_RefNannySetupContext(
"__get__", 0);
13200 __Pyx_XDECREF(__pyx_r);
13201 __Pyx_INCREF(__pyx_v_self->obj);
13202 __pyx_r = __pyx_v_self->obj;
13215 __Pyx_XGIVEREF(__pyx_r);
13216 __Pyx_RefNannyFinishContext();
13229 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self);
13230 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) {
13231 PyObject *__pyx_r = 0;
13232 __Pyx_RefNannyDeclarations
13233 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
13234 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
13237 __Pyx_RefNannyFinishContext();
13241 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
13242 Py_ssize_t __pyx_v_length;
13243 PyObject *__pyx_r = NULL;
13244 __Pyx_RefNannyDeclarations
13245 PyObject *__pyx_t_1 = NULL;
13246 Py_ssize_t *__pyx_t_2;
13247 Py_ssize_t *__pyx_t_3;
13248 Py_ssize_t *__pyx_t_4;
13249 PyObject *__pyx_t_5 = NULL;
13250 int __pyx_lineno = 0;
13251 const char *__pyx_filename = NULL;
13252 int __pyx_clineno = 0;
13253 __Pyx_RefNannySetupContext(
"__get__", 0);
13262 __Pyx_XDECREF(__pyx_r);
13263 __pyx_t_1 = PyList_New(0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 564, __pyx_L1_error)
13264 __Pyx_GOTREF(__pyx_t_1);
13265 __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
13266 for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
13267 __pyx_t_2 = __pyx_t_4;
13268 __pyx_v_length = (__pyx_t_2[0]);
13269 __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_length);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 564, __pyx_L1_error)
13270 __Pyx_GOTREF(__pyx_t_5);
13271 if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 564, __pyx_L1_error)
13272 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13274 __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1));
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 564, __pyx_L1_error)
13275 __Pyx_GOTREF(__pyx_t_5);
13276 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13277 __pyx_r = __pyx_t_5;
13291 __Pyx_XDECREF(__pyx_t_1);
13292 __Pyx_XDECREF(__pyx_t_5);
13293 __Pyx_AddTraceback(
"View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13296 __Pyx_XGIVEREF(__pyx_r);
13297 __Pyx_RefNannyFinishContext();
13310 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self);
13311 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) {
13312 PyObject *__pyx_r = 0;
13313 __Pyx_RefNannyDeclarations
13314 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
13315 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
13318 __Pyx_RefNannyFinishContext();
13322 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
13323 Py_ssize_t __pyx_v_stride;
13324 PyObject *__pyx_r = NULL;
13325 __Pyx_RefNannyDeclarations
13327 PyObject *__pyx_t_2 = NULL;
13328 Py_ssize_t *__pyx_t_3;
13329 Py_ssize_t *__pyx_t_4;
13330 Py_ssize_t *__pyx_t_5;
13331 PyObject *__pyx_t_6 = NULL;
13332 int __pyx_lineno = 0;
13333 const char *__pyx_filename = NULL;
13334 int __pyx_clineno = 0;
13335 __Pyx_RefNannySetupContext(
"__get__", 0);
13344 __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0);
13345 if (unlikely(__pyx_t_1)) {
13354 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__17, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 570, __pyx_L1_error)
13355 __Pyx_GOTREF(__pyx_t_2);
13356 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
13357 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13358 __PYX_ERR(1, 570, __pyx_L1_error)
13376 __Pyx_XDECREF(__pyx_r);
13377 __pyx_t_2 = PyList_New(0);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 572, __pyx_L1_error)
13378 __Pyx_GOTREF(__pyx_t_2);
13379 __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim);
13380 for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
13381 __pyx_t_3 = __pyx_t_5;
13382 __pyx_v_stride = (__pyx_t_3[0]);
13383 __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_stride);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 572, __pyx_L1_error)
13384 __Pyx_GOTREF(__pyx_t_6);
13385 if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(1, 572, __pyx_L1_error)
13386 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
13388 __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2));
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 572, __pyx_L1_error)
13389 __Pyx_GOTREF(__pyx_t_6);
13390 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13391 __pyx_r = __pyx_t_6;
13405 __Pyx_XDECREF(__pyx_t_2);
13406 __Pyx_XDECREF(__pyx_t_6);
13407 __Pyx_AddTraceback(
"View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13410 __Pyx_XGIVEREF(__pyx_r);
13411 __Pyx_RefNannyFinishContext();
13424 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self);
13425 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) {
13426 PyObject *__pyx_r = 0;
13427 __Pyx_RefNannyDeclarations
13428 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
13429 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
13432 __Pyx_RefNannyFinishContext();
13436 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
13437 Py_ssize_t __pyx_v_suboffset;
13438 PyObject *__pyx_r = NULL;
13439 __Pyx_RefNannyDeclarations
13441 PyObject *__pyx_t_2 = NULL;
13442 PyObject *__pyx_t_3 = NULL;
13443 Py_ssize_t *__pyx_t_4;
13444 Py_ssize_t *__pyx_t_5;
13445 Py_ssize_t *__pyx_t_6;
13446 int __pyx_lineno = 0;
13447 const char *__pyx_filename = NULL;
13448 int __pyx_clineno = 0;
13449 __Pyx_RefNannySetupContext(
"__get__", 0);
13458 __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0);
13468 __Pyx_XDECREF(__pyx_r);
13469 __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 577, __pyx_L1_error)
13470 __Pyx_GOTREF(__pyx_t_2);
13471 __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__18, __pyx_t_2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 577, __pyx_L1_error)
13472 __Pyx_GOTREF(__pyx_t_3);
13473 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13474 __pyx_r = __pyx_t_3;
13494 __Pyx_XDECREF(__pyx_r);
13495 __pyx_t_3 = PyList_New(0);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 579, __pyx_L1_error)
13496 __Pyx_GOTREF(__pyx_t_3);
13497 __pyx_t_5 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim);
13498 for (__pyx_t_6 = __pyx_v_self->view.suboffsets; __pyx_t_6 < __pyx_t_5; __pyx_t_6++) {
13499 __pyx_t_4 = __pyx_t_6;
13500 __pyx_v_suboffset = (__pyx_t_4[0]);
13501 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_suboffset);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 579, __pyx_L1_error)
13502 __Pyx_GOTREF(__pyx_t_2);
13503 if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(1, 579, __pyx_L1_error)
13504 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13506 __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_3));
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 579, __pyx_L1_error)
13507 __Pyx_GOTREF(__pyx_t_2);
13508 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13509 __pyx_r = __pyx_t_2;
13523 __Pyx_XDECREF(__pyx_t_2);
13524 __Pyx_XDECREF(__pyx_t_3);
13525 __Pyx_AddTraceback(
"View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13528 __Pyx_XGIVEREF(__pyx_r);
13529 __Pyx_RefNannyFinishContext();
13542 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self);
13543 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) {
13544 PyObject *__pyx_r = 0;
13545 __Pyx_RefNannyDeclarations
13546 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
13547 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
13550 __Pyx_RefNannyFinishContext();
13554 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
13555 PyObject *__pyx_r = NULL;
13556 __Pyx_RefNannyDeclarations
13557 PyObject *__pyx_t_1 = NULL;
13558 int __pyx_lineno = 0;
13559 const char *__pyx_filename = NULL;
13560 int __pyx_clineno = 0;
13561 __Pyx_RefNannySetupContext(
"__get__", 0);
13570 __Pyx_XDECREF(__pyx_r);
13571 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 583, __pyx_L1_error)
13572 __Pyx_GOTREF(__pyx_t_1);
13573 __pyx_r = __pyx_t_1;
13587 __Pyx_XDECREF(__pyx_t_1);
13588 __Pyx_AddTraceback(
"View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13591 __Pyx_XGIVEREF(__pyx_r);
13592 __Pyx_RefNannyFinishContext();
13605 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self);
13606 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) {
13607 PyObject *__pyx_r = 0;
13608 __Pyx_RefNannyDeclarations
13609 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
13610 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
13613 __Pyx_RefNannyFinishContext();
13617 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
13618 PyObject *__pyx_r = NULL;
13619 __Pyx_RefNannyDeclarations
13620 PyObject *__pyx_t_1 = NULL;
13621 int __pyx_lineno = 0;
13622 const char *__pyx_filename = NULL;
13623 int __pyx_clineno = 0;
13624 __Pyx_RefNannySetupContext(
"__get__", 0);
13633 __Pyx_XDECREF(__pyx_r);
13634 __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 587, __pyx_L1_error)
13635 __Pyx_GOTREF(__pyx_t_1);
13636 __pyx_r = __pyx_t_1;
13650 __Pyx_XDECREF(__pyx_t_1);
13651 __Pyx_AddTraceback(
"View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13654 __Pyx_XGIVEREF(__pyx_r);
13655 __Pyx_RefNannyFinishContext();
13668 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self);
13669 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) {
13670 PyObject *__pyx_r = 0;
13671 __Pyx_RefNannyDeclarations
13672 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
13673 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
13676 __Pyx_RefNannyFinishContext();
13680 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
13681 PyObject *__pyx_r = NULL;
13682 __Pyx_RefNannyDeclarations
13683 PyObject *__pyx_t_1 = NULL;
13684 PyObject *__pyx_t_2 = NULL;
13685 PyObject *__pyx_t_3 = NULL;
13686 int __pyx_lineno = 0;
13687 const char *__pyx_filename = NULL;
13688 int __pyx_clineno = 0;
13689 __Pyx_RefNannySetupContext(
"__get__", 0);
13698 __Pyx_XDECREF(__pyx_r);
13699 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 591, __pyx_L1_error)
13700 __Pyx_GOTREF(__pyx_t_1);
13701 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 591, __pyx_L1_error)
13702 __Pyx_GOTREF(__pyx_t_2);
13703 __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 591, __pyx_L1_error)
13704 __Pyx_GOTREF(__pyx_t_3);
13705 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13706 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
13707 __pyx_r = __pyx_t_3;
13721 __Pyx_XDECREF(__pyx_t_1);
13722 __Pyx_XDECREF(__pyx_t_2);
13723 __Pyx_XDECREF(__pyx_t_3);
13724 __Pyx_AddTraceback(
"View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13727 __Pyx_XGIVEREF(__pyx_r);
13728 __Pyx_RefNannyFinishContext();
13741 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self);
13742 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) {
13743 PyObject *__pyx_r = 0;
13744 __Pyx_RefNannyDeclarations
13745 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
13746 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
13749 __Pyx_RefNannyFinishContext();
13753 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
13754 PyObject *__pyx_v_result = NULL;
13755 PyObject *__pyx_v_length = NULL;
13756 PyObject *__pyx_r = NULL;
13757 __Pyx_RefNannyDeclarations
13760 Py_ssize_t *__pyx_t_3;
13761 Py_ssize_t *__pyx_t_4;
13762 Py_ssize_t *__pyx_t_5;
13763 PyObject *__pyx_t_6 = NULL;
13764 int __pyx_lineno = 0;
13765 const char *__pyx_filename = NULL;
13766 int __pyx_clineno = 0;
13767 __Pyx_RefNannySetupContext(
"__get__", 0);
13776 __pyx_t_1 = (__pyx_v_self->_size == Py_None);
13777 __pyx_t_2 = (__pyx_t_1 != 0);
13787 __Pyx_INCREF(__pyx_int_1);
13788 __pyx_v_result = __pyx_int_1;
13797 __pyx_t_4 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
13798 for (__pyx_t_5 = __pyx_v_self->view.shape; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
13799 __pyx_t_3 = __pyx_t_5;
13800 __pyx_t_6 = PyInt_FromSsize_t((__pyx_t_3[0]));
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 598, __pyx_L1_error)
13801 __Pyx_GOTREF(__pyx_t_6);
13802 __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_6);
13812 __pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 599, __pyx_L1_error)
13813 __Pyx_GOTREF(__pyx_t_6);
13814 __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_6);
13825 __Pyx_INCREF(__pyx_v_result);
13826 __Pyx_GIVEREF(__pyx_v_result);
13827 __Pyx_GOTREF(__pyx_v_self->_size);
13828 __Pyx_DECREF(__pyx_v_self->_size);
13829 __pyx_v_self->_size = __pyx_v_result;
13847 __Pyx_XDECREF(__pyx_r);
13848 __Pyx_INCREF(__pyx_v_self->_size);
13849 __pyx_r = __pyx_v_self->_size;
13862 __Pyx_XDECREF(__pyx_t_6);
13863 __Pyx_AddTraceback(
"View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13866 __Pyx_XDECREF(__pyx_v_result);
13867 __Pyx_XDECREF(__pyx_v_length);
13868 __Pyx_XGIVEREF(__pyx_r);
13869 __Pyx_RefNannyFinishContext();
13882 static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self);
13883 static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) {
13884 Py_ssize_t __pyx_r;
13885 __Pyx_RefNannyDeclarations
13886 __Pyx_RefNannySetupContext(
"__len__ (wrapper)", 0);
13887 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
13890 __Pyx_RefNannyFinishContext();
13894 static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(
struct __pyx_memoryview_obj *__pyx_v_self) {
13895 Py_ssize_t __pyx_r;
13896 __Pyx_RefNannyDeclarations
13898 __Pyx_RefNannySetupContext(
"__len__", 0);
13907 __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0);
13917 __pyx_r = (__pyx_v_self->view.shape[0]);
13949 __Pyx_RefNannyFinishContext();
13962 static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self);
13963 static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) {
13964 PyObject *__pyx_r = 0;
13965 __Pyx_RefNannyDeclarations
13966 __Pyx_RefNannySetupContext(
"__repr__ (wrapper)", 0);
13967 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
13970 __Pyx_RefNannyFinishContext();
13974 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(
struct __pyx_memoryview_obj *__pyx_v_self) {
13975 PyObject *__pyx_r = NULL;
13976 __Pyx_RefNannyDeclarations
13977 PyObject *__pyx_t_1 = NULL;
13978 PyObject *__pyx_t_2 = NULL;
13979 PyObject *__pyx_t_3 = NULL;
13980 int __pyx_lineno = 0;
13981 const char *__pyx_filename = NULL;
13982 int __pyx_clineno = 0;
13983 __Pyx_RefNannySetupContext(
"__repr__", 0);
13992 __Pyx_XDECREF(__pyx_r);
13993 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 612, __pyx_L1_error)
13994 __Pyx_GOTREF(__pyx_t_1);
13995 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 612, __pyx_L1_error)
13996 __Pyx_GOTREF(__pyx_t_2);
13997 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13998 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 612, __pyx_L1_error)
13999 __Pyx_GOTREF(__pyx_t_1);
14000 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14009 __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self));
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 613, __pyx_L1_error)
14010 __Pyx_GOTREF(__pyx_t_2);
14019 __pyx_t_3 = PyTuple_New(2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 612, __pyx_L1_error)
14020 __Pyx_GOTREF(__pyx_t_3);
14021 __Pyx_GIVEREF(__pyx_t_1);
14022 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
14023 __Pyx_GIVEREF(__pyx_t_2);
14024 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
14027 __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_3);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 612, __pyx_L1_error)
14028 __Pyx_GOTREF(__pyx_t_2);
14029 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14030 __pyx_r = __pyx_t_2;
14044 __Pyx_XDECREF(__pyx_t_1);
14045 __Pyx_XDECREF(__pyx_t_2);
14046 __Pyx_XDECREF(__pyx_t_3);
14047 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14050 __Pyx_XGIVEREF(__pyx_r);
14051 __Pyx_RefNannyFinishContext();
14064 static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self);
14065 static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) {
14066 PyObject *__pyx_r = 0;
14067 __Pyx_RefNannyDeclarations
14068 __Pyx_RefNannySetupContext(
"__str__ (wrapper)", 0);
14069 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
14072 __Pyx_RefNannyFinishContext();
14076 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(
struct __pyx_memoryview_obj *__pyx_v_self) {
14077 PyObject *__pyx_r = NULL;
14078 __Pyx_RefNannyDeclarations
14079 PyObject *__pyx_t_1 = NULL;
14080 PyObject *__pyx_t_2 = NULL;
14081 int __pyx_lineno = 0;
14082 const char *__pyx_filename = NULL;
14083 int __pyx_clineno = 0;
14084 __Pyx_RefNannySetupContext(
"__str__", 0);
14093 __Pyx_XDECREF(__pyx_r);
14094 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 616, __pyx_L1_error)
14095 __Pyx_GOTREF(__pyx_t_1);
14096 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 616, __pyx_L1_error)
14097 __Pyx_GOTREF(__pyx_t_2);
14098 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14099 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 616, __pyx_L1_error)
14100 __Pyx_GOTREF(__pyx_t_1);
14101 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14102 __pyx_t_2 = PyTuple_New(1);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 616, __pyx_L1_error)
14103 __Pyx_GOTREF(__pyx_t_2);
14104 __Pyx_GIVEREF(__pyx_t_1);
14105 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
14107 __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 616, __pyx_L1_error)
14108 __Pyx_GOTREF(__pyx_t_1);
14109 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
14110 __pyx_r = __pyx_t_1;
14124 __Pyx_XDECREF(__pyx_t_1);
14125 __Pyx_XDECREF(__pyx_t_2);
14126 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14129 __Pyx_XGIVEREF(__pyx_r);
14130 __Pyx_RefNannyFinishContext();
14143 static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
14144 static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
14145 PyObject *__pyx_r = 0;
14146 __Pyx_RefNannyDeclarations
14147 __Pyx_RefNannySetupContext(
"is_c_contig (wrapper)", 0);
14148 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((
struct __pyx_memoryview_obj *)__pyx_v_self));
14151 __Pyx_RefNannyFinishContext();
14155 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(
struct __pyx_memoryview_obj *__pyx_v_self) {
14156 __Pyx_memviewslice *__pyx_v_mslice;
14157 __Pyx_memviewslice __pyx_v_tmp;
14158 PyObject *__pyx_r = NULL;
14159 __Pyx_RefNannyDeclarations
14160 __Pyx_memviewslice *__pyx_t_1;
14161 PyObject *__pyx_t_2 = NULL;
14162 int __pyx_lineno = 0;
14163 const char *__pyx_filename = NULL;
14164 int __pyx_clineno = 0;
14165 __Pyx_RefNannySetupContext(
"is_c_contig", 0);
14174 __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp));
if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 622, __pyx_L1_error)
14175 __pyx_v_mslice = __pyx_t_1;
14184 __Pyx_XDECREF(__pyx_r);
14185 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]),
'C', __pyx_v_self->view.ndim));
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 623, __pyx_L1_error)
14186 __Pyx_GOTREF(__pyx_t_2);
14187 __pyx_r = __pyx_t_2;
14201 __Pyx_XDECREF(__pyx_t_2);
14202 __Pyx_AddTraceback(
"View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
14205 __Pyx_XGIVEREF(__pyx_r);
14206 __Pyx_RefNannyFinishContext();
14219 static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
14220 static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
14221 PyObject *__pyx_r = 0;
14222 __Pyx_RefNannyDeclarations
14223 __Pyx_RefNannySetupContext(
"is_f_contig (wrapper)", 0);
14224 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((
struct __pyx_memoryview_obj *)__pyx_v_self));
14227 __Pyx_RefNannyFinishContext();
14231 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(
struct __pyx_memoryview_obj *__pyx_v_self) {
14232 __Pyx_memviewslice *__pyx_v_mslice;
14233 __Pyx_memviewslice __pyx_v_tmp;
14234 PyObject *__pyx_r = NULL;
14235 __Pyx_RefNannyDeclarations
14236 __Pyx_memviewslice *__pyx_t_1;
14237 PyObject *__pyx_t_2 = NULL;
14238 int __pyx_lineno = 0;
14239 const char *__pyx_filename = NULL;
14240 int __pyx_clineno = 0;
14241 __Pyx_RefNannySetupContext(
"is_f_contig", 0);
14250 __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp));
if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(1, 628, __pyx_L1_error)
14251 __pyx_v_mslice = __pyx_t_1;
14260 __Pyx_XDECREF(__pyx_r);
14261 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]),
'F', __pyx_v_self->view.ndim));
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 629, __pyx_L1_error)
14262 __Pyx_GOTREF(__pyx_t_2);
14263 __pyx_r = __pyx_t_2;
14277 __Pyx_XDECREF(__pyx_t_2);
14278 __Pyx_AddTraceback(
"View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
14281 __Pyx_XGIVEREF(__pyx_r);
14282 __Pyx_RefNannyFinishContext();
14295 static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
14296 static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
14297 PyObject *__pyx_r = 0;
14298 __Pyx_RefNannyDeclarations
14299 __Pyx_RefNannySetupContext(
"copy (wrapper)", 0);
14300 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((
struct __pyx_memoryview_obj *)__pyx_v_self));
14303 __Pyx_RefNannyFinishContext();
14307 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(
struct __pyx_memoryview_obj *__pyx_v_self) {
14308 __Pyx_memviewslice __pyx_v_mslice;
14310 PyObject *__pyx_r = NULL;
14311 __Pyx_RefNannyDeclarations
14312 __Pyx_memviewslice __pyx_t_1;
14313 PyObject *__pyx_t_2 = NULL;
14314 int __pyx_lineno = 0;
14315 const char *__pyx_filename = NULL;
14316 int __pyx_clineno = 0;
14317 __Pyx_RefNannySetupContext(
"copy", 0);
14326 __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS));
14335 __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice));
14344 __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((
char *)
"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object);
if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 636, __pyx_L1_error)
14345 __pyx_v_mslice = __pyx_t_1;
14354 __Pyx_XDECREF(__pyx_r);
14355 __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice));
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 641, __pyx_L1_error)
14356 __Pyx_GOTREF(__pyx_t_2);
14357 __pyx_r = __pyx_t_2;
14371 __Pyx_XDECREF(__pyx_t_2);
14372 __Pyx_AddTraceback(
"View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
14375 __Pyx_XGIVEREF(__pyx_r);
14376 __Pyx_RefNannyFinishContext();
14389 static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
14390 static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
14391 PyObject *__pyx_r = 0;
14392 __Pyx_RefNannyDeclarations
14393 __Pyx_RefNannySetupContext(
"copy_fortran (wrapper)", 0);
14394 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((
struct __pyx_memoryview_obj *)__pyx_v_self));
14397 __Pyx_RefNannyFinishContext();
14401 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(
struct __pyx_memoryview_obj *__pyx_v_self) {
14402 __Pyx_memviewslice __pyx_v_src;
14403 __Pyx_memviewslice __pyx_v_dst;
14405 PyObject *__pyx_r = NULL;
14406 __Pyx_RefNannyDeclarations
14407 __Pyx_memviewslice __pyx_t_1;
14408 PyObject *__pyx_t_2 = NULL;
14409 int __pyx_lineno = 0;
14410 const char *__pyx_filename = NULL;
14411 int __pyx_clineno = 0;
14412 __Pyx_RefNannySetupContext(
"copy_fortran", 0);
14421 __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS));
14430 __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src));
14439 __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((
char *)
"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object);
if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 648, __pyx_L1_error)
14440 __pyx_v_dst = __pyx_t_1;
14449 __Pyx_XDECREF(__pyx_r);
14450 __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst));
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 653, __pyx_L1_error)
14451 __Pyx_GOTREF(__pyx_t_2);
14452 __pyx_r = __pyx_t_2;
14466 __Pyx_XDECREF(__pyx_t_2);
14467 __Pyx_AddTraceback(
"View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename);
14470 __Pyx_XGIVEREF(__pyx_r);
14471 __Pyx_RefNannyFinishContext();
14482 static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
14483 static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
14484 PyObject *__pyx_r = 0;
14485 __Pyx_RefNannyDeclarations
14486 __Pyx_RefNannySetupContext(
"__reduce_cython__ (wrapper)", 0);
14487 __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
14490 __Pyx_RefNannyFinishContext();
14494 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED
struct __pyx_memoryview_obj *__pyx_v_self) {
14495 PyObject *__pyx_r = NULL;
14496 __Pyx_RefNannyDeclarations
14497 PyObject *__pyx_t_1 = NULL;
14498 int __pyx_lineno = 0;
14499 const char *__pyx_filename = NULL;
14500 int __pyx_clineno = 0;
14501 __Pyx_RefNannySetupContext(
"__reduce_cython__", 0);
14509 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__19, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
14510 __Pyx_GOTREF(__pyx_t_1);
14511 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
14512 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14513 __PYX_ERR(1, 2, __pyx_L1_error)
14523 __Pyx_XDECREF(__pyx_t_1);
14524 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14526 __Pyx_XGIVEREF(__pyx_r);
14527 __Pyx_RefNannyFinishContext();
14539 static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state);
14540 static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
14541 PyObject *__pyx_r = 0;
14542 __Pyx_RefNannyDeclarations
14543 __Pyx_RefNannySetupContext(
"__setstate_cython__ (wrapper)", 0);
14544 __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((
struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
14547 __Pyx_RefNannyFinishContext();
14551 static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
14552 PyObject *__pyx_r = NULL;
14553 __Pyx_RefNannyDeclarations
14554 PyObject *__pyx_t_1 = NULL;
14555 int __pyx_lineno = 0;
14556 const char *__pyx_filename = NULL;
14557 int __pyx_clineno = 0;
14558 __Pyx_RefNannySetupContext(
"__setstate_cython__", 0);
14565 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__20, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
14566 __Pyx_GOTREF(__pyx_t_1);
14567 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
14568 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
14569 __PYX_ERR(1, 4, __pyx_L1_error)
14580 __Pyx_XDECREF(__pyx_t_1);
14581 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
14583 __Pyx_XGIVEREF(__pyx_r);
14584 __Pyx_RefNannyFinishContext();
14596 static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o,
int __pyx_v_flags,
int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) {
14597 struct __pyx_memoryview_obj *__pyx_v_result = 0;
14598 PyObject *__pyx_r = NULL;
14599 __Pyx_RefNannyDeclarations
14600 PyObject *__pyx_t_1 = NULL;
14601 PyObject *__pyx_t_2 = NULL;
14602 PyObject *__pyx_t_3 = NULL;
14603 int __pyx_lineno = 0;
14604 const char *__pyx_filename = NULL;
14605 int __pyx_clineno = 0;
14606 __Pyx_RefNannySetupContext(
"memoryview_cwrapper", 0);
14615 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 658, __pyx_L1_error)
14616 __Pyx_GOTREF(__pyx_t_1);
14617 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 658, __pyx_L1_error)
14618 __Pyx_GOTREF(__pyx_t_2);
14619 __pyx_t_3 = PyTuple_New(3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 658, __pyx_L1_error)
14620 __Pyx_GOTREF(__pyx_t_3);
14621 __Pyx_INCREF(__pyx_v_o);
14622 __Pyx_GIVEREF(__pyx_v_o);
14623 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o);
14624 __Pyx_GIVEREF(__pyx_t_1);
14625 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
14626 __Pyx_GIVEREF(__pyx_t_2);
14627 PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
14630 __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 658, __pyx_L1_error)
14631 __Pyx_GOTREF(__pyx_t_2);
14632 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14633 __pyx_v_result = ((
struct __pyx_memoryview_obj *)__pyx_t_2);
14643 __pyx_v_result->typeinfo = __pyx_v_typeinfo;
14652 __Pyx_XDECREF(__pyx_r);
14653 __Pyx_INCREF(((PyObject *)__pyx_v_result));
14654 __pyx_r = ((PyObject *)__pyx_v_result);
14667 __Pyx_XDECREF(__pyx_t_1);
14668 __Pyx_XDECREF(__pyx_t_2);
14669 __Pyx_XDECREF(__pyx_t_3);
14670 __Pyx_AddTraceback(
"View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
14673 __Pyx_XDECREF((PyObject *)__pyx_v_result);
14674 __Pyx_XGIVEREF(__pyx_r);
14675 __Pyx_RefNannyFinishContext();
14687 static CYTHON_INLINE
int __pyx_memoryview_check(PyObject *__pyx_v_o) {
14689 __Pyx_RefNannyDeclarations
14691 __Pyx_RefNannySetupContext(
"memoryview_check", 0);
14700 __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type);
14701 __pyx_r = __pyx_t_1;
14714 __Pyx_RefNannyFinishContext();
14726 static PyObject *_unellipsify(PyObject *__pyx_v_index,
int __pyx_v_ndim) {
14727 PyObject *__pyx_v_tup = NULL;
14728 PyObject *__pyx_v_result = NULL;
14729 int __pyx_v_have_slices;
14730 int __pyx_v_seen_ellipsis;
14731 CYTHON_UNUSED PyObject *__pyx_v_idx = NULL;
14732 PyObject *__pyx_v_item = NULL;
14733 Py_ssize_t __pyx_v_nslices;
14734 PyObject *__pyx_r = NULL;
14735 __Pyx_RefNannyDeclarations
14738 PyObject *__pyx_t_3 = NULL;
14739 PyObject *__pyx_t_4 = NULL;
14740 Py_ssize_t __pyx_t_5;
14741 PyObject *(*__pyx_t_6)(PyObject *);
14742 PyObject *__pyx_t_7 = NULL;
14743 Py_ssize_t __pyx_t_8;
14746 PyObject *__pyx_t_11 = NULL;
14747 int __pyx_lineno = 0;
14748 const char *__pyx_filename = NULL;
14749 int __pyx_clineno = 0;
14750 __Pyx_RefNannySetupContext(
"_unellipsify", 0);
14759 __pyx_t_1 = PyTuple_Check(__pyx_v_index);
14760 __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
14770 __pyx_t_3 = PyTuple_New(1);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 672, __pyx_L1_error)
14771 __Pyx_GOTREF(__pyx_t_3);
14772 __Pyx_INCREF(__pyx_v_index);
14773 __Pyx_GIVEREF(__pyx_v_index);
14774 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index);
14775 __pyx_v_tup = __pyx_t_3;
14796 __Pyx_INCREF(__pyx_v_index);
14797 __pyx_v_tup = __pyx_v_index;
14808 __pyx_t_3 = PyList_New(0);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 676, __pyx_L1_error)
14809 __Pyx_GOTREF(__pyx_t_3);
14810 __pyx_v_result = ((PyObject*)__pyx_t_3);
14820 __pyx_v_have_slices = 0;
14829 __pyx_v_seen_ellipsis = 0;
14838 __Pyx_INCREF(__pyx_int_0);
14839 __pyx_t_3 = __pyx_int_0;
14840 if (likely(PyList_CheckExact(__pyx_v_tup)) || PyTuple_CheckExact(__pyx_v_tup)) {
14841 __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
14844 __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 679, __pyx_L1_error)
14845 __Pyx_GOTREF(__pyx_t_4);
14846 __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext;
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 679, __pyx_L1_error)
14849 if (likely(!__pyx_t_6)) {
14850 if (likely(PyList_CheckExact(__pyx_t_4))) {
14851 if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4))
break;
14852 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14853 __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++;
if (unlikely(0 < 0)) __PYX_ERR(1, 679, __pyx_L1_error)
14855 __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++;
if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 679, __pyx_L1_error)
14856 __Pyx_GOTREF(__pyx_t_7);
14859 if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4))
break;
14860 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14861 __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++;
if (unlikely(0 < 0)) __PYX_ERR(1, 679, __pyx_L1_error)
14863 __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++;
if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 679, __pyx_L1_error)
14864 __Pyx_GOTREF(__pyx_t_7);
14868 __pyx_t_7 = __pyx_t_6(__pyx_t_4);
14869 if (unlikely(!__pyx_t_7)) {
14870 PyObject* exc_type = PyErr_Occurred();
14872 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
14873 else __PYX_ERR(1, 679, __pyx_L1_error)
14877 __Pyx_GOTREF(__pyx_t_7);
14879 __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
14881 __Pyx_INCREF(__pyx_t_3);
14882 __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3);
14883 __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0);
if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 679, __pyx_L1_error)
14884 __Pyx_GOTREF(__pyx_t_7);
14885 __Pyx_DECREF(__pyx_t_3);
14886 __pyx_t_3 = __pyx_t_7;
14896 __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
14897 __pyx_t_1 = (__pyx_t_2 != 0);
14907 __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0);
14917 __pyx_t_8 = PyObject_Length(__pyx_v_tup);
if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(1, 682, __pyx_L1_error)
14918 __pyx_t_7 = PyList_New(1 * ((((__pyx_v_ndim - __pyx_t_8) + 1)<0) ? 0:((__pyx_v_ndim - __pyx_t_8) + 1)));
if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 682, __pyx_L1_error)
14919 __Pyx_GOTREF(__pyx_t_7);
14920 { Py_ssize_t __pyx_temp;
14921 for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) {
14922 __Pyx_INCREF(__pyx_slice__21);
14923 __Pyx_GIVEREF(__pyx_slice__21);
14924 PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__21);
14927 __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_7);
if (unlikely(__pyx_t_9 == ((
int)-1))) __PYX_ERR(1, 682, __pyx_L1_error)
14928 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
14937 __pyx_v_seen_ellipsis = 1;
14957 __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__21);
if (unlikely(__pyx_t_9 == ((
int)-1))) __PYX_ERR(1, 685, __pyx_L1_error)
14968 __pyx_v_have_slices = 1;
14988 __pyx_t_2 = PySlice_Check(__pyx_v_item);
14989 __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0);
14992 __pyx_t_1 = __pyx_t_10;
14993 goto __pyx_L9_bool_binop_done;
14995 __pyx_t_10 = ((!(PyIndex_Check(__pyx_v_item) != 0)) != 0);
14996 __pyx_t_1 = __pyx_t_10;
14997 __pyx_L9_bool_binop_done:;
14998 if (unlikely(__pyx_t_1)) {
15007 __pyx_t_7 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Cannot_index_with_type_s, ((PyObject *)Py_TYPE(__pyx_v_item)));
if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 689, __pyx_L1_error)
15008 __Pyx_GOTREF(__pyx_t_7);
15009 __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7);
if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 689, __pyx_L1_error)
15010 __Pyx_GOTREF(__pyx_t_11);
15011 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
15012 __Pyx_Raise(__pyx_t_11, 0, 0, 0);
15013 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
15014 __PYX_ERR(1, 689, __pyx_L1_error)
15032 __pyx_t_10 = (__pyx_v_have_slices != 0);
15035 __pyx_t_1 = __pyx_t_10;
15036 goto __pyx_L11_bool_binop_done;
15038 __pyx_t_10 = PySlice_Check(__pyx_v_item);
15039 __pyx_t_2 = (__pyx_t_10 != 0);
15040 __pyx_t_1 = __pyx_t_2;
15041 __pyx_L11_bool_binop_done:;
15042 __pyx_v_have_slices = __pyx_t_1;
15051 __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item);
if (unlikely(__pyx_t_9 == ((
int)-1))) __PYX_ERR(1, 692, __pyx_L1_error)
15063 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15064 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15073 __pyx_t_5 = PyList_GET_SIZE(__pyx_v_result);
if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(1, 694, __pyx_L1_error)
15074 __pyx_v_nslices = (__pyx_v_ndim - __pyx_t_5);
15083 __pyx_t_1 = (__pyx_v_nslices != 0);
15093 __pyx_t_3 = PyList_New(1 * ((__pyx_v_nslices<0) ? 0:__pyx_v_nslices));
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 696, __pyx_L1_error)
15094 __Pyx_GOTREF(__pyx_t_3);
15095 { Py_ssize_t __pyx_temp;
15096 for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) {
15097 __Pyx_INCREF(__pyx_slice__21);
15098 __Pyx_GIVEREF(__pyx_slice__21);
15099 PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__21);
15102 __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_3);
if (unlikely(__pyx_t_9 == ((
int)-1))) __PYX_ERR(1, 696, __pyx_L1_error)
15103 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15121 __Pyx_XDECREF(__pyx_r);
15122 if (!__pyx_v_have_slices) {
15124 __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 698, __pyx_L1_error)
15125 __Pyx_GOTREF(__pyx_t_4);
15126 __pyx_t_3 = __pyx_t_4;
15128 goto __pyx_L14_bool_binop_done;
15130 __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nslices);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 698, __pyx_L1_error)
15131 __Pyx_GOTREF(__pyx_t_4);
15132 __pyx_t_3 = __pyx_t_4;
15134 __pyx_L14_bool_binop_done:;
15135 __pyx_t_4 = PyList_AsTuple(__pyx_v_result);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 698, __pyx_L1_error)
15136 __Pyx_GOTREF(__pyx_t_4);
15137 __pyx_t_11 = PyTuple_New(2);
if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 698, __pyx_L1_error)
15138 __Pyx_GOTREF(__pyx_t_11);
15139 __Pyx_GIVEREF(__pyx_t_3);
15140 PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3);
15141 __Pyx_GIVEREF(__pyx_t_4);
15142 PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_4);
15145 __pyx_r = ((PyObject*)__pyx_t_11);
15159 __Pyx_XDECREF(__pyx_t_3);
15160 __Pyx_XDECREF(__pyx_t_4);
15161 __Pyx_XDECREF(__pyx_t_7);
15162 __Pyx_XDECREF(__pyx_t_11);
15163 __Pyx_AddTraceback(
"View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename);
15166 __Pyx_XDECREF(__pyx_v_tup);
15167 __Pyx_XDECREF(__pyx_v_result);
15168 __Pyx_XDECREF(__pyx_v_idx);
15169 __Pyx_XDECREF(__pyx_v_item);
15170 __Pyx_XGIVEREF(__pyx_r);
15171 __Pyx_RefNannyFinishContext();
15183 static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets,
int __pyx_v_ndim) {
15184 Py_ssize_t __pyx_v_suboffset;
15185 PyObject *__pyx_r = NULL;
15186 __Pyx_RefNannyDeclarations
15187 Py_ssize_t *__pyx_t_1;
15188 Py_ssize_t *__pyx_t_2;
15189 Py_ssize_t *__pyx_t_3;
15191 PyObject *__pyx_t_5 = NULL;
15192 int __pyx_lineno = 0;
15193 const char *__pyx_filename = NULL;
15194 int __pyx_clineno = 0;
15195 __Pyx_RefNannySetupContext(
"assert_direct_dimensions", 0);
15204 __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim);
15205 for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) {
15206 __pyx_t_1 = __pyx_t_3;
15207 __pyx_v_suboffset = (__pyx_t_1[0]);
15216 __pyx_t_4 = ((__pyx_v_suboffset >= 0) != 0);
15217 if (unlikely(__pyx_t_4)) {
15226 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__22, NULL);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 703, __pyx_L1_error)
15227 __Pyx_GOTREF(__pyx_t_5);
15228 __Pyx_Raise(__pyx_t_5, 0, 0, 0);
15229 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
15230 __PYX_ERR(1, 703, __pyx_L1_error)
15251 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
15254 __Pyx_XDECREF(__pyx_t_5);
15255 __Pyx_AddTraceback(
"View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename);
15258 __Pyx_XGIVEREF(__pyx_r);
15259 __Pyx_RefNannyFinishContext();
15271 static struct __pyx_memoryview_obj *__pyx_memview_slice(
struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) {
15272 int __pyx_v_new_ndim;
15273 int __pyx_v_suboffset_dim;
15275 __Pyx_memviewslice __pyx_v_src;
15276 __Pyx_memviewslice __pyx_v_dst;
15277 __Pyx_memviewslice *__pyx_v_p_src;
15278 struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0;
15279 __Pyx_memviewslice *__pyx_v_p_dst;
15280 int *__pyx_v_p_suboffset_dim;
15281 Py_ssize_t __pyx_v_start;
15282 Py_ssize_t __pyx_v_stop;
15283 Py_ssize_t __pyx_v_step;
15284 int __pyx_v_have_start;
15285 int __pyx_v_have_stop;
15286 int __pyx_v_have_step;
15287 PyObject *__pyx_v_index = NULL;
15288 struct __pyx_memoryview_obj *__pyx_r = NULL;
15289 __Pyx_RefNannyDeclarations
15292 PyObject *__pyx_t_3 = NULL;
15293 struct __pyx_memoryview_obj *__pyx_t_4;
15296 Py_ssize_t __pyx_t_7;
15297 PyObject *(*__pyx_t_8)(PyObject *);
15298 PyObject *__pyx_t_9 = NULL;
15299 Py_ssize_t __pyx_t_10;
15301 Py_ssize_t __pyx_t_12;
15302 int __pyx_lineno = 0;
15303 const char *__pyx_filename = NULL;
15304 int __pyx_clineno = 0;
15305 __Pyx_RefNannySetupContext(
"memview_slice", 0);
15314 __pyx_v_new_ndim = 0;
15315 __pyx_v_suboffset_dim = -1;
15324 (void)(memset((&__pyx_v_dst), 0, (
sizeof(__pyx_v_dst))));
15333 #ifndef CYTHON_WITHOUT_ASSERTIONS
15334 if (unlikely(!Py_OptimizeFlag)) {
15335 if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) {
15336 PyErr_SetNone(PyExc_AssertionError);
15337 __PYX_ERR(1, 722, __pyx_L1_error)
15349 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
15350 __pyx_t_2 = (__pyx_t_1 != 0);
15360 if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(1, 725, __pyx_L1_error)
15361 __pyx_t_3 = ((PyObject *)__pyx_v_memview);
15362 __Pyx_INCREF(__pyx_t_3);
15363 __pyx_v_memviewsliceobj = ((
struct __pyx_memoryviewslice_obj *)__pyx_t_3);
15373 __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice);
15393 __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src));
15402 __pyx_v_p_src = (&__pyx_v_src);
15413 __pyx_t_4 = __pyx_v_p_src->memview;
15414 __pyx_v_dst.memview = __pyx_t_4;
15423 __pyx_t_5 = __pyx_v_p_src->data;
15424 __pyx_v_dst.data = __pyx_t_5;
15433 __pyx_v_p_dst = (&__pyx_v_dst);
15442 __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim);
15452 if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) {
15453 __pyx_t_3 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0;
15456 __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 746, __pyx_L1_error)
15457 __Pyx_GOTREF(__pyx_t_3);
15458 __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext;
if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 746, __pyx_L1_error)
15461 if (likely(!__pyx_t_8)) {
15462 if (likely(PyList_CheckExact(__pyx_t_3))) {
15463 if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3))
break;
15464 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
15465 __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++;
if (unlikely(0 < 0)) __PYX_ERR(1, 746, __pyx_L1_error)
15467 __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++;
if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 746, __pyx_L1_error)
15468 __Pyx_GOTREF(__pyx_t_9);
15471 if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3))
break;
15472 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
15473 __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++;
if (unlikely(0 < 0)) __PYX_ERR(1, 746, __pyx_L1_error)
15475 __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++;
if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 746, __pyx_L1_error)
15476 __Pyx_GOTREF(__pyx_t_9);
15480 __pyx_t_9 = __pyx_t_8(__pyx_t_3);
15481 if (unlikely(!__pyx_t_9)) {
15482 PyObject* exc_type = PyErr_Occurred();
15484 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
15485 else __PYX_ERR(1, 746, __pyx_L1_error)
15489 __Pyx_GOTREF(__pyx_t_9);
15491 __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9);
15493 __pyx_v_dim = __pyx_t_6;
15494 __pyx_t_6 = (__pyx_t_6 + 1);
15503 __pyx_t_2 = (PyIndex_Check(__pyx_v_index) != 0);
15513 __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index);
if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 751, __pyx_L1_error)
15522 __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0);
if (unlikely(__pyx_t_11 == ((
int)-1))) __PYX_ERR(1, 748, __pyx_L1_error)
15541 __pyx_t_2 = (__pyx_v_index == Py_None);
15542 __pyx_t_1 = (__pyx_t_2 != 0);
15552 (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1;
15561 (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0;
15570 (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1
L;
15579 __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
15599 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start);
if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 760, __pyx_L1_error)
15600 __Pyx_GOTREF(__pyx_t_9);
15601 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 760, __pyx_L1_error)
15603 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
15605 __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9);
if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 760, __pyx_L1_error)
15606 __pyx_t_10 = __pyx_t_12;
15607 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
15608 goto __pyx_L7_bool_binop_done;
15611 __pyx_L7_bool_binop_done:;
15612 __pyx_v_start = __pyx_t_10;
15621 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop);
if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 761, __pyx_L1_error)
15622 __Pyx_GOTREF(__pyx_t_9);
15623 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 761, __pyx_L1_error)
15625 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
15627 __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9);
if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 761, __pyx_L1_error)
15628 __pyx_t_10 = __pyx_t_12;
15629 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
15630 goto __pyx_L9_bool_binop_done;
15633 __pyx_L9_bool_binop_done:;
15634 __pyx_v_stop = __pyx_t_10;
15643 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step);
if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 762, __pyx_L1_error)
15644 __Pyx_GOTREF(__pyx_t_9);
15645 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(1, 762, __pyx_L1_error)
15647 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
15649 __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9);
if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 762, __pyx_L1_error)
15650 __pyx_t_10 = __pyx_t_12;
15651 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
15652 goto __pyx_L11_bool_binop_done;
15655 __pyx_L11_bool_binop_done:;
15656 __pyx_v_step = __pyx_t_10;
15665 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start);
if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 764, __pyx_L1_error)
15666 __Pyx_GOTREF(__pyx_t_9);
15667 __pyx_t_1 = (__pyx_t_9 != Py_None);
15668 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
15669 __pyx_v_have_start = __pyx_t_1;
15678 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop);
if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 765, __pyx_L1_error)
15679 __Pyx_GOTREF(__pyx_t_9);
15680 __pyx_t_1 = (__pyx_t_9 != Py_None);
15681 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
15682 __pyx_v_have_stop = __pyx_t_1;
15691 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step);
if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 766, __pyx_L1_error)
15692 __Pyx_GOTREF(__pyx_t_9);
15693 __pyx_t_1 = (__pyx_t_9 != Py_None);
15694 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
15695 __pyx_v_have_step = __pyx_t_1;
15704 __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1);
if (unlikely(__pyx_t_11 == ((
int)-1))) __PYX_ERR(1, 768, __pyx_L1_error)
15713 __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
15725 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15734 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
15735 __pyx_t_2 = (__pyx_t_1 != 0);
15745 __Pyx_XDECREF(((PyObject *)__pyx_r));
15754 if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError(
"memviewsliceobj"); __PYX_ERR(1, 778, __pyx_L1_error) }
15763 if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError(
"memviewsliceobj"); __PYX_ERR(1, 779, __pyx_L1_error) }
15772 __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 777, __pyx_L1_error)
15773 __Pyx_GOTREF(__pyx_t_3);
15774 if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(1, 777, __pyx_L1_error)
15775 __pyx_r = ((
struct __pyx_memoryview_obj *)__pyx_t_3);
15796 __Pyx_XDECREF(((PyObject *)__pyx_r));
15805 __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 782, __pyx_L1_error)
15806 __Pyx_GOTREF(__pyx_t_3);
15815 if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(1, 782, __pyx_L1_error)
15816 __pyx_r = ((
struct __pyx_memoryview_obj *)__pyx_t_3);
15831 __Pyx_XDECREF(__pyx_t_3);
15832 __Pyx_XDECREF(__pyx_t_9);
15833 __Pyx_AddTraceback(
"View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
15836 __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj);
15837 __Pyx_XDECREF(__pyx_v_index);
15838 __Pyx_XGIVEREF((PyObject *)__pyx_r);
15839 __Pyx_RefNannyFinishContext();
15851 static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset,
int __pyx_v_dim,
int __pyx_v_new_ndim,
int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step,
int __pyx_v_have_start,
int __pyx_v_have_stop,
int __pyx_v_have_step,
int __pyx_v_is_slice) {
15852 Py_ssize_t __pyx_v_new_shape;
15853 int __pyx_v_negative_step;
15858 int __pyx_lineno = 0;
15859 const char *__pyx_filename = NULL;
15860 int __pyx_clineno = 0;
15869 __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0);
15879 __pyx_t_1 = ((__pyx_v_start < 0) != 0);
15889 __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
15907 __pyx_t_1 = (0 <= __pyx_v_start);
15909 __pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
15911 __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
15921 __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((
char *)
"Index out of bounds (axis %d)"), __pyx_v_dim);
if (unlikely(__pyx_t_3 == ((
int)-1))) __PYX_ERR(1, 832, __pyx_L1_error)
15950 __pyx_t_1 = ((__pyx_v_have_step != 0) != 0);
15953 __pyx_t_2 = __pyx_t_1;
15954 goto __pyx_L6_bool_binop_done;
15956 __pyx_t_1 = ((__pyx_v_step < 0) != 0);
15957 __pyx_t_2 = __pyx_t_1;
15958 __pyx_L6_bool_binop_done:;
15959 __pyx_v_negative_step = __pyx_t_2;
15968 __pyx_t_1 = (__pyx_v_have_step != 0);
15971 __pyx_t_2 = __pyx_t_1;
15972 goto __pyx_L9_bool_binop_done;
15974 __pyx_t_1 = ((__pyx_v_step == 0) != 0);
15975 __pyx_t_2 = __pyx_t_1;
15976 __pyx_L9_bool_binop_done:;
15986 __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((
char *)
"Step may not be zero (axis %d)"), __pyx_v_dim);
if (unlikely(__pyx_t_3 == ((
int)-1))) __PYX_ERR(1, 838, __pyx_L1_error)
16004 __pyx_t_2 = (__pyx_v_have_start != 0);
16014 __pyx_t_2 = ((__pyx_v_start < 0) != 0);
16024 __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
16033 __pyx_t_2 = ((__pyx_v_start < 0) != 0);
16071 __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0);
16081 __pyx_t_2 = (__pyx_v_negative_step != 0);
16091 __pyx_v_start = (__pyx_v_shape - 1);
16111 __pyx_v_start = __pyx_v_shape;
16143 __pyx_t_2 = (__pyx_v_negative_step != 0);
16153 __pyx_v_start = (__pyx_v_shape - 1);
16186 __pyx_t_2 = (__pyx_v_have_stop != 0);
16196 __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
16206 __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape);
16215 __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
16253 __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0);
16263 __pyx_v_stop = __pyx_v_shape;
16293 __pyx_t_2 = (__pyx_v_negative_step != 0);
16303 __pyx_v_stop = -1
L;
16323 __pyx_v_stop = __pyx_v_shape;
16336 __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0);
16364 __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step);
16373 __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0);
16383 __pyx_v_new_shape = (__pyx_v_new_shape + 1);
16401 __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0);
16411 __pyx_v_new_shape = 0;
16429 (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step);
16438 (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape;
16447 (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset;
16458 __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0);
16468 __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride));
16488 __pyx_t_3 = (__pyx_v_suboffset_dim[0]);
16489 (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride));
16500 __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
16510 __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0);
16520 __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0);
16530 __pyx_v_dst->data = ((((
char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset);
16558 __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((
char *)
"All dimensions preceding dimension %d must be indexed and not sliced"), __pyx_v_dim);
if (unlikely(__pyx_t_3 == ((
int)-1))) __PYX_ERR(1, 899, __pyx_L1_error)
16580 (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim;
16615 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
16617 __Pyx_AddTraceback(
"View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
16619 __Pyx_PyGILState_Release(__pyx_gilstate_save);
16635 static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view,
char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) {
16636 Py_ssize_t __pyx_v_shape;
16637 Py_ssize_t __pyx_v_stride;
16638 Py_ssize_t __pyx_v_suboffset;
16639 Py_ssize_t __pyx_v_itemsize;
16640 char *__pyx_v_resultp;
16642 __Pyx_RefNannyDeclarations
16643 Py_ssize_t __pyx_t_1;
16645 PyObject *__pyx_t_3 = NULL;
16646 PyObject *__pyx_t_4 = NULL;
16647 int __pyx_lineno = 0;
16648 const char *__pyx_filename = NULL;
16649 int __pyx_clineno = 0;
16650 __Pyx_RefNannySetupContext(
"pybuffer_index", 0);
16659 __pyx_v_suboffset = -1
L;
16668 __pyx_t_1 = __pyx_v_view->itemsize;
16669 __pyx_v_itemsize = __pyx_t_1;
16678 __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0);
16688 if (unlikely(__pyx_v_itemsize == 0)) {
16689 PyErr_SetString(PyExc_ZeroDivisionError,
"integer division or modulo by zero");
16690 __PYX_ERR(1, 917, __pyx_L1_error)
16692 else if (
sizeof(Py_ssize_t) ==
sizeof(
long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) {
16693 PyErr_SetString(PyExc_OverflowError,
"value too large to perform division");
16694 __PYX_ERR(1, 917, __pyx_L1_error)
16696 __pyx_v_shape = __Pyx_div_Py_ssize_t(__pyx_v_view->len, __pyx_v_itemsize);
16705 __pyx_v_stride = __pyx_v_itemsize;
16725 __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]);
16734 __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]);
16743 __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0);
16753 __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]);
16773 __pyx_t_2 = ((__pyx_v_index < 0) != 0);
16783 __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim]));
16792 __pyx_t_2 = ((__pyx_v_index < 0) != 0);
16793 if (unlikely(__pyx_t_2)) {
16802 __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 928, __pyx_L1_error)
16803 __Pyx_GOTREF(__pyx_t_3);
16804 __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 928, __pyx_L1_error)
16805 __Pyx_GOTREF(__pyx_t_4);
16806 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16807 __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 928, __pyx_L1_error)
16808 __Pyx_GOTREF(__pyx_t_3);
16809 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16810 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
16811 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16812 __PYX_ERR(1, 928, __pyx_L1_error)
16839 __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0);
16840 if (unlikely(__pyx_t_2)) {
16849 __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 931, __pyx_L1_error)
16850 __Pyx_GOTREF(__pyx_t_3);
16851 __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 931, __pyx_L1_error)
16852 __Pyx_GOTREF(__pyx_t_4);
16853 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16854 __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 931, __pyx_L1_error)
16855 __Pyx_GOTREF(__pyx_t_3);
16856 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
16857 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
16858 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16859 __PYX_ERR(1, 931, __pyx_L1_error)
16877 __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride));
16886 __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
16896 __pyx_v_resultp = ((((
char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset);
16914 __pyx_r = __pyx_v_resultp;
16927 __Pyx_XDECREF(__pyx_t_3);
16928 __Pyx_XDECREF(__pyx_t_4);
16929 __Pyx_AddTraceback(
"View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
16932 __Pyx_RefNannyFinishContext();
16944 static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
16946 Py_ssize_t *__pyx_v_shape;
16947 Py_ssize_t *__pyx_v_strides;
16952 Py_ssize_t *__pyx_t_2;
16955 Py_ssize_t __pyx_t_5;
16956 Py_ssize_t __pyx_t_6;
16960 int __pyx_lineno = 0;
16961 const char *__pyx_filename = NULL;
16962 int __pyx_clineno = 0;
16971 __pyx_t_1 = __pyx_v_memslice->memview->view.ndim;
16972 __pyx_v_ndim = __pyx_t_1;
16981 __pyx_t_2 = __pyx_v_memslice->shape;
16982 __pyx_v_shape = __pyx_t_2;
16991 __pyx_t_2 = __pyx_v_memslice->strides;
16992 __pyx_v_strides = __pyx_t_2;
17001 __pyx_t_3 = __Pyx_div_long(__pyx_v_ndim, 2);
17002 __pyx_t_4 = __pyx_t_3;
17003 for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) {
17004 __pyx_v_i = __pyx_t_1;
17013 __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i);
17022 __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]);
17023 __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]);
17024 (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5;
17025 (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6;
17034 __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]);
17035 __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]);
17036 (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6;
17037 (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5;
17046 __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0);
17049 __pyx_t_7 = __pyx_t_8;
17050 goto __pyx_L6_bool_binop_done;
17052 __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0);
17053 __pyx_t_7 = __pyx_t_8;
17054 __pyx_L6_bool_binop_done:;
17064 __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, ((
char *)
"Cannot transpose memoryview with indirect dimensions"));
if (unlikely(__pyx_t_9 == ((
int)-1))) __PYX_ERR(1, 957, __pyx_L1_error)
17098 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
17100 __Pyx_AddTraceback(
"View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
17102 __Pyx_PyGILState_Release(__pyx_gilstate_save);
17119 static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self);
17120 static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) {
17121 __Pyx_RefNannyDeclarations
17122 __Pyx_RefNannySetupContext(
"__dealloc__ (wrapper)", 0);
17123 __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((
struct __pyx_memoryviewslice_obj *)__pyx_v_self));
17126 __Pyx_RefNannyFinishContext();
17129 static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(
struct __pyx_memoryviewslice_obj *__pyx_v_self) {
17130 __Pyx_RefNannyDeclarations
17131 __Pyx_RefNannySetupContext(
"__dealloc__", 0);
17140 __PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1);
17151 __Pyx_RefNannyFinishContext();
17162 static PyObject *__pyx_memoryviewslice_convert_item_to_object(
struct __pyx_memoryviewslice_obj *__pyx_v_self,
char *__pyx_v_itemp) {
17163 PyObject *__pyx_r = NULL;
17164 __Pyx_RefNannyDeclarations
17166 PyObject *__pyx_t_2 = NULL;
17167 int __pyx_lineno = 0;
17168 const char *__pyx_filename = NULL;
17169 int __pyx_clineno = 0;
17170 __Pyx_RefNannySetupContext(
"convert_item_to_object", 0);
17179 __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0);
17189 __Pyx_XDECREF(__pyx_r);
17190 __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 981, __pyx_L1_error)
17191 __Pyx_GOTREF(__pyx_t_2);
17192 __pyx_r = __pyx_t_2;
17213 __Pyx_XDECREF(__pyx_r);
17214 __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((
struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 983, __pyx_L1_error)
17215 __Pyx_GOTREF(__pyx_t_2);
17216 __pyx_r = __pyx_t_2;
17231 __Pyx_XDECREF(__pyx_t_2);
17232 __Pyx_AddTraceback(
"View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
17235 __Pyx_XGIVEREF(__pyx_r);
17236 __Pyx_RefNannyFinishContext();
17248 static PyObject *__pyx_memoryviewslice_assign_item_from_object(
struct __pyx_memoryviewslice_obj *__pyx_v_self,
char *__pyx_v_itemp, PyObject *__pyx_v_value) {
17249 PyObject *__pyx_r = NULL;
17250 __Pyx_RefNannyDeclarations
17253 PyObject *__pyx_t_3 = NULL;
17254 int __pyx_lineno = 0;
17255 const char *__pyx_filename = NULL;
17256 int __pyx_clineno = 0;
17257 __Pyx_RefNannySetupContext(
"assign_item_from_object", 0);
17266 __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0);
17276 __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value);
if (unlikely(__pyx_t_2 == ((
int)0))) __PYX_ERR(1, 987, __pyx_L1_error)
17296 __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((
struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 989, __pyx_L1_error)
17297 __Pyx_GOTREF(__pyx_t_3);
17298 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17311 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
17314 __Pyx_XDECREF(__pyx_t_3);
17315 __Pyx_AddTraceback(
"View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
17318 __Pyx_XGIVEREF(__pyx_r);
17319 __Pyx_RefNannyFinishContext();
17332 static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self);
17333 static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self) {
17334 PyObject *__pyx_r = 0;
17335 __Pyx_RefNannyDeclarations
17336 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
17337 __pyx_r = __pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(((
struct __pyx_memoryviewslice_obj *)__pyx_v_self));
17340 __Pyx_RefNannyFinishContext();
17344 static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(
struct __pyx_memoryviewslice_obj *__pyx_v_self) {
17345 PyObject *__pyx_r = NULL;
17346 __Pyx_RefNannyDeclarations
17347 __Pyx_RefNannySetupContext(
"__get__", 0);
17356 __Pyx_XDECREF(__pyx_r);
17357 __Pyx_INCREF(__pyx_v_self->from_object);
17358 __pyx_r = __pyx_v_self->from_object;
17371 __Pyx_XGIVEREF(__pyx_r);
17372 __Pyx_RefNannyFinishContext();
17383 static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
17384 static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
17385 PyObject *__pyx_r = 0;
17386 __Pyx_RefNannyDeclarations
17387 __Pyx_RefNannySetupContext(
"__reduce_cython__ (wrapper)", 0);
17388 __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((
struct __pyx_memoryviewslice_obj *)__pyx_v_self));
17391 __Pyx_RefNannyFinishContext();
17395 static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED
struct __pyx_memoryviewslice_obj *__pyx_v_self) {
17396 PyObject *__pyx_r = NULL;
17397 __Pyx_RefNannyDeclarations
17398 PyObject *__pyx_t_1 = NULL;
17399 int __pyx_lineno = 0;
17400 const char *__pyx_filename = NULL;
17401 int __pyx_clineno = 0;
17402 __Pyx_RefNannySetupContext(
"__reduce_cython__", 0);
17410 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__23, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
17411 __Pyx_GOTREF(__pyx_t_1);
17412 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
17413 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17414 __PYX_ERR(1, 2, __pyx_L1_error)
17424 __Pyx_XDECREF(__pyx_t_1);
17425 __Pyx_AddTraceback(
"View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
17427 __Pyx_XGIVEREF(__pyx_r);
17428 __Pyx_RefNannyFinishContext();
17440 static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state);
17441 static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
17442 PyObject *__pyx_r = 0;
17443 __Pyx_RefNannyDeclarations
17444 __Pyx_RefNannySetupContext(
"__setstate_cython__ (wrapper)", 0);
17445 __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((
struct __pyx_memoryviewslice_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
17448 __Pyx_RefNannyFinishContext();
17452 static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
17453 PyObject *__pyx_r = NULL;
17454 __Pyx_RefNannyDeclarations
17455 PyObject *__pyx_t_1 = NULL;
17456 int __pyx_lineno = 0;
17457 const char *__pyx_filename = NULL;
17458 int __pyx_clineno = 0;
17459 __Pyx_RefNannySetupContext(
"__setstate_cython__", 0);
17466 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__24, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
17467 __Pyx_GOTREF(__pyx_t_1);
17468 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
17469 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
17470 __PYX_ERR(1, 4, __pyx_L1_error)
17481 __Pyx_XDECREF(__pyx_t_1);
17482 __Pyx_AddTraceback(
"View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
17484 __Pyx_XGIVEREF(__pyx_r);
17485 __Pyx_RefNannyFinishContext();
17497 static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice,
int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(
char *),
int (*__pyx_v_to_dtype_func)(
char *, PyObject *),
int __pyx_v_dtype_is_object) {
17498 struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
17499 Py_ssize_t __pyx_v_suboffset;
17500 PyObject *__pyx_v_length = NULL;
17501 PyObject *__pyx_r = NULL;
17502 __Pyx_RefNannyDeclarations
17504 PyObject *__pyx_t_2 = NULL;
17505 PyObject *__pyx_t_3 = NULL;
17506 __Pyx_TypeInfo *__pyx_t_4;
17507 Py_buffer __pyx_t_5;
17508 Py_ssize_t *__pyx_t_6;
17509 Py_ssize_t *__pyx_t_7;
17510 Py_ssize_t *__pyx_t_8;
17511 Py_ssize_t __pyx_t_9;
17512 int __pyx_lineno = 0;
17513 const char *__pyx_filename = NULL;
17514 int __pyx_clineno = 0;
17515 __Pyx_RefNannySetupContext(
"memoryview_fromslice", 0);
17524 __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0);
17534 __Pyx_XDECREF(__pyx_r);
17535 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
17554 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1013, __pyx_L1_error)
17555 __Pyx_GOTREF(__pyx_t_2);
17556 __pyx_t_3 = PyTuple_New(3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1013, __pyx_L1_error)
17557 __Pyx_GOTREF(__pyx_t_3);
17558 __Pyx_INCREF(Py_None);
17559 __Pyx_GIVEREF(Py_None);
17560 PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
17561 __Pyx_INCREF(__pyx_int_0);
17562 __Pyx_GIVEREF(__pyx_int_0);
17563 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
17564 __Pyx_GIVEREF(__pyx_t_2);
17565 PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
17567 __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1013, __pyx_L1_error)
17568 __Pyx_GOTREF(__pyx_t_2);
17569 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17570 __pyx_v_result = ((
struct __pyx_memoryviewslice_obj *)__pyx_t_2);
17580 __pyx_v_result->from_slice = __pyx_v_memviewslice;
17589 __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1);
17598 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s_base);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1018, __pyx_L1_error)
17599 __Pyx_GOTREF(__pyx_t_2);
17600 __Pyx_GIVEREF(__pyx_t_2);
17601 __Pyx_GOTREF(__pyx_v_result->from_object);
17602 __Pyx_DECREF(__pyx_v_result->from_object);
17603 __pyx_v_result->from_object = __pyx_t_2;
17613 __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo;
17614 __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4;
17623 __pyx_t_5 = __pyx_v_memviewslice.memview->view;
17624 __pyx_v_result->__pyx_base.view = __pyx_t_5;
17633 __pyx_v_result->__pyx_base.view.buf = ((
void *)__pyx_v_memviewslice.data);
17642 __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim;
17651 ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None;
17660 Py_INCREF(Py_None);
17669 __pyx_t_1 = ((((
struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0);
17679 __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS;
17699 __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO;
17710 __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape);
17719 __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides);
17728 __pyx_v_result->__pyx_base.view.suboffsets = NULL;
17737 __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim);
17738 for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
17739 __pyx_t_6 = __pyx_t_8;
17740 __pyx_v_suboffset = (__pyx_t_6[0]);
17749 __pyx_t_1 = ((__pyx_v_suboffset >= 0) != 0);
17759 __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets);
17768 goto __pyx_L6_break;
17788 __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize;
17789 __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
17798 __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim);
17799 for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
17800 __pyx_t_6 = __pyx_t_8;
17801 __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0]));
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1043, __pyx_L1_error)
17802 __Pyx_GOTREF(__pyx_t_2);
17803 __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2);
17813 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1044, __pyx_L1_error)
17814 __Pyx_GOTREF(__pyx_t_2);
17815 __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1044, __pyx_L1_error)
17816 __Pyx_GOTREF(__pyx_t_3);
17817 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
17818 __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3);
if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(1, 1044, __pyx_L1_error)
17819 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
17820 __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
17830 __pyx_v_result->to_object_func = __pyx_v_to_object_func;
17839 __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func;
17848 __Pyx_XDECREF(__pyx_r);
17849 __Pyx_INCREF(((PyObject *)__pyx_v_result));
17850 __pyx_r = ((PyObject *)__pyx_v_result);
17863 __Pyx_XDECREF(__pyx_t_2);
17864 __Pyx_XDECREF(__pyx_t_3);
17865 __Pyx_AddTraceback(
"View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
17868 __Pyx_XDECREF((PyObject *)__pyx_v_result);
17869 __Pyx_XDECREF(__pyx_v_length);
17870 __Pyx_XGIVEREF(__pyx_r);
17871 __Pyx_RefNannyFinishContext();
17883 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(
struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) {
17884 struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0;
17885 __Pyx_memviewslice *__pyx_r;
17886 __Pyx_RefNannyDeclarations
17889 PyObject *__pyx_t_3 = NULL;
17890 int __pyx_lineno = 0;
17891 const char *__pyx_filename = NULL;
17892 int __pyx_clineno = 0;
17893 __Pyx_RefNannySetupContext(
"get_slice_from_memview", 0);
17902 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
17903 __pyx_t_2 = (__pyx_t_1 != 0);
17913 if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(1, 1056, __pyx_L1_error)
17914 __pyx_t_3 = ((PyObject *)__pyx_v_memview);
17915 __Pyx_INCREF(__pyx_t_3);
17916 __pyx_v_obj = ((
struct __pyx_memoryviewslice_obj *)__pyx_t_3);
17926 __pyx_r = (&__pyx_v_obj->from_slice);
17946 __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice);
17955 __pyx_r = __pyx_v_mslice;
17969 __Pyx_XDECREF(__pyx_t_3);
17970 __Pyx_AddTraceback(
"View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
17973 __Pyx_XDECREF((PyObject *)__pyx_v_obj);
17974 __Pyx_RefNannyFinishContext();
17986 static void __pyx_memoryview_slice_copy(
struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) {
17988 Py_ssize_t *__pyx_v_shape;
17989 Py_ssize_t *__pyx_v_strides;
17990 Py_ssize_t *__pyx_v_suboffsets;
17991 __Pyx_RefNannyDeclarations
17992 Py_ssize_t *__pyx_t_1;
17996 Py_ssize_t __pyx_t_5;
17997 __Pyx_RefNannySetupContext(
"slice_copy", 0);
18006 __pyx_t_1 = __pyx_v_memview->view.shape;
18007 __pyx_v_shape = __pyx_t_1;
18016 __pyx_t_1 = __pyx_v_memview->view.strides;
18017 __pyx_v_strides = __pyx_t_1;
18026 __pyx_t_1 = __pyx_v_memview->view.suboffsets;
18027 __pyx_v_suboffsets = __pyx_t_1;
18036 __pyx_v_dst->memview = ((
struct __pyx_memoryview_obj *)__pyx_v_memview);
18045 __pyx_v_dst->data = ((
char *)__pyx_v_memview->view.buf);
18054 __pyx_t_2 = __pyx_v_memview->view.ndim;
18055 __pyx_t_3 = __pyx_t_2;
18056 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
18057 __pyx_v_dim = __pyx_t_4;
18066 (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]);
18075 (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]);
18084 if ((__pyx_v_suboffsets != 0)) {
18085 __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]);
18089 (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5;
18101 __Pyx_RefNannyFinishContext();
18112 static PyObject *__pyx_memoryview_copy_object(
struct __pyx_memoryview_obj *__pyx_v_memview) {
18113 __Pyx_memviewslice __pyx_v_memviewslice;
18114 PyObject *__pyx_r = NULL;
18115 __Pyx_RefNannyDeclarations
18116 PyObject *__pyx_t_1 = NULL;
18117 int __pyx_lineno = 0;
18118 const char *__pyx_filename = NULL;
18119 int __pyx_clineno = 0;
18120 __Pyx_RefNannySetupContext(
"memoryview_copy", 0);
18129 __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice));
18138 __Pyx_XDECREF(__pyx_r);
18139 __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice));
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1084, __pyx_L1_error)
18140 __Pyx_GOTREF(__pyx_t_1);
18141 __pyx_r = __pyx_t_1;
18155 __Pyx_XDECREF(__pyx_t_1);
18156 __Pyx_AddTraceback(
"View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
18159 __Pyx_XGIVEREF(__pyx_r);
18160 __Pyx_RefNannyFinishContext();
18172 static PyObject *__pyx_memoryview_copy_object_from_slice(
struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) {
18173 PyObject *(*__pyx_v_to_object_func)(
char *);
18174 int (*__pyx_v_to_dtype_func)(
char *, PyObject *);
18175 PyObject *__pyx_r = NULL;
18176 __Pyx_RefNannyDeclarations
18179 PyObject *(*__pyx_t_3)(
char *);
18180 int (*__pyx_t_4)(
char *, PyObject *);
18181 PyObject *__pyx_t_5 = NULL;
18182 int __pyx_lineno = 0;
18183 const char *__pyx_filename = NULL;
18184 int __pyx_clineno = 0;
18185 __Pyx_RefNannySetupContext(
"memoryview_copy_from_slice", 0);
18194 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
18195 __pyx_t_2 = (__pyx_t_1 != 0);
18205 __pyx_t_3 = ((
struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
18206 __pyx_v_to_object_func = __pyx_t_3;
18215 __pyx_t_4 = ((
struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
18216 __pyx_v_to_dtype_func = __pyx_t_4;
18236 __pyx_v_to_object_func = NULL;
18245 __pyx_v_to_dtype_func = NULL;
18256 __Pyx_XDECREF(__pyx_r);
18265 __pyx_t_5 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object);
if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 1101, __pyx_L1_error)
18266 __Pyx_GOTREF(__pyx_t_5);
18267 __pyx_r = __pyx_t_5;
18281 __Pyx_XDECREF(__pyx_t_5);
18282 __Pyx_AddTraceback(
"View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
18285 __Pyx_XGIVEREF(__pyx_r);
18286 __Pyx_RefNannyFinishContext();
18298 static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
18299 Py_ssize_t __pyx_r;
18309 __pyx_t_1 = ((__pyx_v_arg < 0) != 0);
18319 __pyx_r = (-__pyx_v_arg);
18339 __pyx_r = __pyx_v_arg;
18364 static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice,
int __pyx_v_ndim) {
18366 Py_ssize_t __pyx_v_c_stride;
18367 Py_ssize_t __pyx_v_f_stride;
18381 __pyx_v_c_stride = 0;
18390 __pyx_v_f_stride = 0;
18399 for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
18400 __pyx_v_i = __pyx_t_1;
18409 __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
18419 __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
18428 goto __pyx_L4_break;
18448 __pyx_t_1 = __pyx_v_ndim;
18449 __pyx_t_3 = __pyx_t_1;
18450 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
18451 __pyx_v_i = __pyx_t_4;
18460 __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
18470 __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
18479 goto __pyx_L7_break;
18499 __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0);
18554 static void _copy_strided_to_strided(
char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides,
char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape,
int __pyx_v_ndim,
size_t __pyx_v_itemsize) {
18555 CYTHON_UNUSED Py_ssize_t __pyx_v_i;
18556 CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent;
18557 Py_ssize_t __pyx_v_dst_extent;
18558 Py_ssize_t __pyx_v_src_stride;
18559 Py_ssize_t __pyx_v_dst_stride;
18563 Py_ssize_t __pyx_t_4;
18564 Py_ssize_t __pyx_t_5;
18565 Py_ssize_t __pyx_t_6;
18574 __pyx_v_src_extent = (__pyx_v_src_shape[0]);
18583 __pyx_v_dst_extent = (__pyx_v_dst_shape[0]);
18592 __pyx_v_src_stride = (__pyx_v_src_strides[0]);
18601 __pyx_v_dst_stride = (__pyx_v_dst_strides[0]);
18610 __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
18620 __pyx_t_2 = ((__pyx_v_src_stride > 0) != 0);
18623 __pyx_t_1 = __pyx_t_2;
18624 goto __pyx_L5_bool_binop_done;
18626 __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0);
18629 __pyx_t_1 = __pyx_t_2;
18630 goto __pyx_L5_bool_binop_done;
18640 __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize);
18642 __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
18644 __pyx_t_3 = (__pyx_t_2 != 0);
18645 __pyx_t_1 = __pyx_t_3;
18646 __pyx_L5_bool_binop_done:;
18664 (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent)));
18684 __pyx_t_4 = __pyx_v_dst_extent;
18685 __pyx_t_5 = __pyx_t_4;
18686 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
18687 __pyx_v_i = __pyx_t_6;
18696 (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize));
18705 __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
18714 __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
18737 __pyx_t_4 = __pyx_v_dst_extent;
18738 __pyx_t_5 = __pyx_t_4;
18739 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
18740 __pyx_v_i = __pyx_t_6;
18749 _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize);
18758 __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
18767 __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
18791 static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst,
int __pyx_v_ndim,
size_t __pyx_v_itemsize) {
18800 _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize);
18821 static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src,
int __pyx_v_ndim) {
18822 Py_ssize_t __pyx_v_shape;
18823 Py_ssize_t __pyx_v_size;
18824 Py_ssize_t __pyx_r;
18825 Py_ssize_t __pyx_t_1;
18826 Py_ssize_t *__pyx_t_2;
18827 Py_ssize_t *__pyx_t_3;
18828 Py_ssize_t *__pyx_t_4;
18837 __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
18838 __pyx_v_size = __pyx_t_1;
18847 __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim);
18848 for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
18849 __pyx_t_2 = __pyx_t_4;
18850 __pyx_v_shape = (__pyx_t_2[0]);
18859 __pyx_v_size = (__pyx_v_size * __pyx_v_shape);
18869 __pyx_r = __pyx_v_size;
18893 static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride,
int __pyx_v_ndim,
char __pyx_v_order) {
18895 Py_ssize_t __pyx_r;
18908 __pyx_t_1 = ((__pyx_v_order ==
'F') != 0);
18918 __pyx_t_2 = __pyx_v_ndim;
18919 __pyx_t_3 = __pyx_t_2;
18920 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
18921 __pyx_v_idx = __pyx_t_4;
18930 (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
18939 __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
18960 for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) {
18961 __pyx_v_idx = __pyx_t_2;
18970 (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
18979 __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
18991 __pyx_r = __pyx_v_stride;
19015 static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice,
char __pyx_v_order,
int __pyx_v_ndim) {
19017 void *__pyx_v_result;
19018 size_t __pyx_v_itemsize;
19019 size_t __pyx_v_size;
19021 Py_ssize_t __pyx_t_1;
19024 struct __pyx_memoryview_obj *__pyx_t_4;
19027 int __pyx_lineno = 0;
19028 const char *__pyx_filename = NULL;
19029 int __pyx_clineno = 0;
19038 __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
19039 __pyx_v_itemsize = __pyx_t_1;
19048 __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim);
19057 __pyx_v_result = malloc(__pyx_v_size);
19066 __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0);
19076 __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL);
if (unlikely(__pyx_t_3 == ((
int)-1))) __PYX_ERR(1, 1224, __pyx_L1_error)
19094 __pyx_v_tmpslice->data = ((
char *)__pyx_v_result);
19103 __pyx_t_4 = __pyx_v_src->memview;
19104 __pyx_v_tmpslice->memview = __pyx_t_4;
19113 __pyx_t_3 = __pyx_v_ndim;
19114 __pyx_t_5 = __pyx_t_3;
19115 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
19116 __pyx_v_i = __pyx_t_6;
19125 (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]);
19134 (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1
L;
19144 (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order));
19153 __pyx_t_3 = __pyx_v_ndim;
19154 __pyx_t_5 = __pyx_t_3;
19155 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
19156 __pyx_v_i = __pyx_t_6;
19165 __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0);
19175 (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0;
19194 __pyx_t_2 = (__pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim) != 0);
19204 (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size));
19224 copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize);
19235 __pyx_r = __pyx_v_result;
19250 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
19252 __Pyx_AddTraceback(
"View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename);
19254 __Pyx_PyGILState_Release(__pyx_gilstate_save);
19270 static int __pyx_memoryview_err_extents(
int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) {
19272 __Pyx_RefNannyDeclarations
19273 PyObject *__pyx_t_1 = NULL;
19274 PyObject *__pyx_t_2 = NULL;
19275 PyObject *__pyx_t_3 = NULL;
19276 PyObject *__pyx_t_4 = NULL;
19277 int __pyx_lineno = 0;
19278 const char *__pyx_filename = NULL;
19279 int __pyx_clineno = 0;
19281 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
19283 __Pyx_RefNannySetupContext(
"_err_extents", 0);
19292 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1254, __pyx_L1_error)
19293 __Pyx_GOTREF(__pyx_t_1);
19294 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1254, __pyx_L1_error)
19295 __Pyx_GOTREF(__pyx_t_2);
19296 __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1254, __pyx_L1_error)
19297 __Pyx_GOTREF(__pyx_t_3);
19298 __pyx_t_4 = PyTuple_New(3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1254, __pyx_L1_error)
19299 __Pyx_GOTREF(__pyx_t_4);
19300 __Pyx_GIVEREF(__pyx_t_1);
19301 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
19302 __Pyx_GIVEREF(__pyx_t_2);
19303 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
19304 __Pyx_GIVEREF(__pyx_t_3);
19305 PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
19317 __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_t_4);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1253, __pyx_L1_error)
19318 __Pyx_GOTREF(__pyx_t_3);
19319 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
19320 __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1253, __pyx_L1_error)
19321 __Pyx_GOTREF(__pyx_t_4);
19322 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19323 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
19324 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
19325 __PYX_ERR(1, 1253, __pyx_L1_error)
19337 __Pyx_XDECREF(__pyx_t_1);
19338 __Pyx_XDECREF(__pyx_t_2);
19339 __Pyx_XDECREF(__pyx_t_3);
19340 __Pyx_XDECREF(__pyx_t_4);
19341 __Pyx_AddTraceback(
"View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename);
19343 __Pyx_RefNannyFinishContext();
19345 __Pyx_PyGILState_Release(__pyx_gilstate_save);
19358 static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error,
char *__pyx_v_msg,
int __pyx_v_dim) {
19360 __Pyx_RefNannyDeclarations
19361 PyObject *__pyx_t_1 = NULL;
19362 PyObject *__pyx_t_2 = NULL;
19363 PyObject *__pyx_t_3 = NULL;
19364 PyObject *__pyx_t_4 = NULL;
19365 int __pyx_lineno = 0;
19366 const char *__pyx_filename = NULL;
19367 int __pyx_clineno = 0;
19369 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
19371 __Pyx_RefNannySetupContext(
"_err_dim", 0);
19372 __Pyx_INCREF(__pyx_v_error);
19381 __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1258, __pyx_L1_error)
19382 __Pyx_GOTREF(__pyx_t_2);
19383 __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1258, __pyx_L1_error)
19384 __Pyx_GOTREF(__pyx_t_3);
19385 __pyx_t_4 = PyUnicode_Format(__pyx_t_2, __pyx_t_3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 1258, __pyx_L1_error)
19386 __Pyx_GOTREF(__pyx_t_4);
19387 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19388 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19389 __Pyx_INCREF(__pyx_v_error);
19390 __pyx_t_3 = __pyx_v_error; __pyx_t_2 = NULL;
19391 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
19392 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
19393 if (likely(__pyx_t_2)) {
19394 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_3);
19395 __Pyx_INCREF(__pyx_t_2);
19396 __Pyx_INCREF(
function);
19397 __Pyx_DECREF_SET(__pyx_t_3,
function);
19400 __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
19401 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
19402 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
19403 if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1258, __pyx_L1_error)
19404 __Pyx_GOTREF(__pyx_t_1);
19405 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19406 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
19407 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19408 __PYX_ERR(1, 1258, __pyx_L1_error)
19420 __Pyx_XDECREF(__pyx_t_1);
19421 __Pyx_XDECREF(__pyx_t_2);
19422 __Pyx_XDECREF(__pyx_t_3);
19423 __Pyx_XDECREF(__pyx_t_4);
19424 __Pyx_AddTraceback(
"View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename);
19426 __Pyx_XDECREF(__pyx_v_error);
19427 __Pyx_RefNannyFinishContext();
19429 __Pyx_PyGILState_Release(__pyx_gilstate_save);
19442 static int __pyx_memoryview_err(PyObject *__pyx_v_error,
char *__pyx_v_msg) {
19444 __Pyx_RefNannyDeclarations
19446 PyObject *__pyx_t_2 = NULL;
19447 PyObject *__pyx_t_3 = NULL;
19448 PyObject *__pyx_t_4 = NULL;
19449 PyObject *__pyx_t_5 = NULL;
19450 int __pyx_lineno = 0;
19451 const char *__pyx_filename = NULL;
19452 int __pyx_clineno = 0;
19454 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
19456 __Pyx_RefNannySetupContext(
"_err", 0);
19457 __Pyx_INCREF(__pyx_v_error);
19466 __pyx_t_1 = ((__pyx_v_msg != NULL) != 0);
19467 if (unlikely(__pyx_t_1)) {
19476 __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 1263, __pyx_L1_error)
19477 __Pyx_GOTREF(__pyx_t_3);
19478 __Pyx_INCREF(__pyx_v_error);
19479 __pyx_t_4 = __pyx_v_error; __pyx_t_5 = NULL;
19480 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
19481 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
19482 if (likely(__pyx_t_5)) {
19483 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_4);
19484 __Pyx_INCREF(__pyx_t_5);
19485 __Pyx_INCREF(
function);
19486 __Pyx_DECREF_SET(__pyx_t_4,
function);
19489 __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
19490 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
19491 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
19492 if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1263, __pyx_L1_error)
19493 __Pyx_GOTREF(__pyx_t_2);
19494 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
19495 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
19496 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19497 __PYX_ERR(1, 1263, __pyx_L1_error)
19516 __Pyx_Raise(__pyx_v_error, 0, 0, 0);
19517 __PYX_ERR(1, 1265, __pyx_L1_error)
19530 __Pyx_XDECREF(__pyx_t_2);
19531 __Pyx_XDECREF(__pyx_t_3);
19532 __Pyx_XDECREF(__pyx_t_4);
19533 __Pyx_XDECREF(__pyx_t_5);
19534 __Pyx_AddTraceback(
"View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename);
19536 __Pyx_XDECREF(__pyx_v_error);
19537 __Pyx_RefNannyFinishContext();
19539 __Pyx_PyGILState_Release(__pyx_gilstate_save);
19552 static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst,
int __pyx_v_src_ndim,
int __pyx_v_dst_ndim,
int __pyx_v_dtype_is_object) {
19553 void *__pyx_v_tmpdata;
19554 size_t __pyx_v_itemsize;
19556 char __pyx_v_order;
19557 int __pyx_v_broadcasting;
19558 int __pyx_v_direct_copy;
19559 __Pyx_memviewslice __pyx_v_tmp;
19562 Py_ssize_t __pyx_t_1;
19570 int __pyx_lineno = 0;
19571 const char *__pyx_filename = NULL;
19572 int __pyx_clineno = 0;
19581 __pyx_v_tmpdata = NULL;
19590 __pyx_t_1 = __pyx_v_src.memview->view.itemsize;
19591 __pyx_v_itemsize = __pyx_t_1;
19600 __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim);
19609 __pyx_v_broadcasting = 0;
19618 __pyx_v_direct_copy = 0;
19627 __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0);
19637 __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim);
19656 __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0);
19666 __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim);
19685 __pyx_t_3 = __pyx_v_dst_ndim;
19686 __pyx_t_4 = __pyx_v_src_ndim;
19687 if (((__pyx_t_3 > __pyx_t_4) != 0)) {
19688 __pyx_t_5 = __pyx_t_3;
19690 __pyx_t_5 = __pyx_t_4;
19692 __pyx_v_ndim = __pyx_t_5;
19701 __pyx_t_5 = __pyx_v_ndim;
19702 __pyx_t_3 = __pyx_t_5;
19703 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
19704 __pyx_v_i = __pyx_t_4;
19713 __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0);
19723 __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0);
19733 __pyx_v_broadcasting = 1;
19742 (__pyx_v_src.strides[__pyx_v_i]) = 0;
19762 __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i]));
if (unlikely(__pyx_t_6 == ((
int)-1))) __PYX_ERR(1, 1297, __pyx_L1_error)
19782 __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0);
19792 __pyx_t_6 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((
char *)
"Dimension %d is not direct"), __pyx_v_i);
if (unlikely(__pyx_t_6 == ((
int)-1))) __PYX_ERR(1, 1300, __pyx_L1_error)
19811 __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0);
19821 __pyx_t_2 = ((!(__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0)) != 0);
19831 __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim);
19849 __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim);
if (unlikely(__pyx_t_7 == ((
void *)NULL))) __PYX_ERR(1, 1307, __pyx_L1_error)
19850 __pyx_v_tmpdata = __pyx_t_7;
19859 __pyx_v_src = __pyx_v_tmp;
19877 __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0);
19887 __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src,
'C', __pyx_v_ndim) != 0);
19897 __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst,
'C', __pyx_v_ndim);
19916 __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src,
'F', __pyx_v_ndim) != 0);
19926 __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst,
'F', __pyx_v_ndim);
19945 __pyx_t_2 = (__pyx_v_direct_copy != 0);
19955 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
19964 (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim)));
19973 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
19982 free(__pyx_v_tmpdata);
20019 __pyx_t_2 = (__pyx_v_order ==
'F');
20021 __pyx_t_2 = (
'F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
20023 __pyx_t_8 = (__pyx_t_2 != 0);
20033 __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src));
if (unlikely(__pyx_t_5 == ((
int)0))) __PYX_ERR(1, 1329, __pyx_L1_error)
20042 __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst));
if (unlikely(__pyx_t_5 == ((
int)0))) __PYX_ERR(1, 1330, __pyx_L1_error)
20060 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
20069 copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);
20078 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
20087 free(__pyx_v_tmpdata);
20111 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
20113 __Pyx_AddTraceback(
"View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename);
20115 __Pyx_PyGILState_Release(__pyx_gilstate_save);
20131 static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice,
int __pyx_v_ndim,
int __pyx_v_ndim_other) {
20133 int __pyx_v_offset;
20145 __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim);
20154 for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
20155 __pyx_v_i = __pyx_t_1;
20164 (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]);
20173 (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]);
20182 (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]);
20192 __pyx_t_1 = __pyx_v_offset;
20193 __pyx_t_2 = __pyx_t_1;
20194 for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
20195 __pyx_v_i = __pyx_t_3;
20204 (__pyx_v_mslice->shape[__pyx_v_i]) = 1;
20213 (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]);
20222 (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1
L;
20244 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst,
int __pyx_v_dtype_is_object,
int __pyx_v_ndim,
int __pyx_v_inc) {
20254 __pyx_t_1 = (__pyx_v_dtype_is_object != 0);
20264 __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc);
20294 static void __pyx_memoryview_refcount_objects_in_slice_with_gil(
char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides,
int __pyx_v_ndim,
int __pyx_v_inc) {
20295 __Pyx_RefNannyDeclarations
20297 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
20299 __Pyx_RefNannySetupContext(
"refcount_objects_in_slice_with_gil", 0);
20308 __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc);
20319 __Pyx_RefNannyFinishContext();
20321 __Pyx_PyGILState_Release(__pyx_gilstate_save);
20333 static void __pyx_memoryview_refcount_objects_in_slice(
char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides,
int __pyx_v_ndim,
int __pyx_v_inc) {
20334 CYTHON_UNUSED Py_ssize_t __pyx_v_i;
20335 __Pyx_RefNannyDeclarations
20336 Py_ssize_t __pyx_t_1;
20337 Py_ssize_t __pyx_t_2;
20338 Py_ssize_t __pyx_t_3;
20340 __Pyx_RefNannySetupContext(
"refcount_objects_in_slice", 0);
20349 __pyx_t_1 = (__pyx_v_shape[0]);
20350 __pyx_t_2 = __pyx_t_1;
20351 for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
20352 __pyx_v_i = __pyx_t_3;
20361 __pyx_t_4 = ((__pyx_v_ndim == 1) != 0);
20371 __pyx_t_4 = (__pyx_v_inc != 0);
20381 Py_INCREF((((PyObject **)__pyx_v_data)[0]));
20401 Py_DECREF((((PyObject **)__pyx_v_data)[0]));
20431 __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc);
20442 __pyx_v_data = (__pyx_v_data + (__pyx_v_strides[0]));
20454 __Pyx_RefNannyFinishContext();
20465 static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst,
int __pyx_v_ndim,
size_t __pyx_v_itemsize,
void *__pyx_v_item,
int __pyx_v_dtype_is_object) {
20474 __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
20483 __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item);
20492 __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
20513 static void __pyx_memoryview__slice_assign_scalar(
char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides,
int __pyx_v_ndim,
size_t __pyx_v_itemsize,
void *__pyx_v_item) {
20514 CYTHON_UNUSED Py_ssize_t __pyx_v_i;
20515 Py_ssize_t __pyx_v_stride;
20516 Py_ssize_t __pyx_v_extent;
20518 Py_ssize_t __pyx_t_2;
20519 Py_ssize_t __pyx_t_3;
20520 Py_ssize_t __pyx_t_4;
20529 __pyx_v_stride = (__pyx_v_strides[0]);
20538 __pyx_v_extent = (__pyx_v_shape[0]);
20547 __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
20557 __pyx_t_2 = __pyx_v_extent;
20558 __pyx_t_3 = __pyx_t_2;
20559 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
20560 __pyx_v_i = __pyx_t_4;
20569 (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize));
20578 __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
20599 __pyx_t_2 = __pyx_v_extent;
20600 __pyx_t_3 = __pyx_t_2;
20601 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
20602 __pyx_v_i = __pyx_t_4;
20611 __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item);
20620 __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
20643 static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
20644 static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {
"__pyx_unpickle_Enum", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, METH_VARARGS|METH_KEYWORDS, 0};
20645 static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
20646 PyObject *__pyx_v___pyx_type = 0;
20647 long __pyx_v___pyx_checksum;
20648 PyObject *__pyx_v___pyx_state = 0;
20649 int __pyx_lineno = 0;
20650 const char *__pyx_filename = NULL;
20651 int __pyx_clineno = 0;
20652 PyObject *__pyx_r = 0;
20653 __Pyx_RefNannyDeclarations
20654 __Pyx_RefNannySetupContext(
"__pyx_unpickle_Enum (wrapper)", 0);
20656 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
20657 PyObject* values[3] = {0,0,0};
20658 if (unlikely(__pyx_kwds)) {
20659 Py_ssize_t kw_args;
20660 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
20661 switch (pos_args) {
20662 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
20663 CYTHON_FALLTHROUGH;
20664 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
20665 CYTHON_FALLTHROUGH;
20666 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
20667 CYTHON_FALLTHROUGH;
20669 default:
goto __pyx_L5_argtuple_error;
20671 kw_args = PyDict_Size(__pyx_kwds);
20672 switch (pos_args) {
20674 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
20675 else goto __pyx_L5_argtuple_error;
20676 CYTHON_FALLTHROUGH;
20678 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
20680 __Pyx_RaiseArgtupleInvalid(
"__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error)
20682 CYTHON_FALLTHROUGH;
20684 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
20686 __Pyx_RaiseArgtupleInvalid(
"__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error)
20689 if (unlikely(kw_args > 0)) {
20690 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__pyx_unpickle_Enum") < 0)) __PYX_ERR(1, 1, __pyx_L3_error)
20692 }
else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
20693 goto __pyx_L5_argtuple_error;
20695 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
20696 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
20697 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
20699 __pyx_v___pyx_type = values[0];
20700 __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]);
if (unlikely((__pyx_v___pyx_checksum == (
long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error)
20701 __pyx_v___pyx_state = values[2];
20703 goto __pyx_L4_argument_unpacking_done;
20704 __pyx_L5_argtuple_error:;
20705 __Pyx_RaiseArgtupleInvalid(
"__pyx_unpickle_Enum", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error)
20707 __Pyx_AddTraceback(
"View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
20708 __Pyx_RefNannyFinishContext();
20710 __pyx_L4_argument_unpacking_done:;
20711 __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
20714 __Pyx_RefNannyFinishContext();
20718 static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type,
long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
20719 PyObject *__pyx_v___pyx_PickleError = 0;
20720 PyObject *__pyx_v___pyx_result = 0;
20721 PyObject *__pyx_r = NULL;
20722 __Pyx_RefNannyDeclarations
20724 PyObject *__pyx_t_2 = NULL;
20725 PyObject *__pyx_t_3 = NULL;
20726 PyObject *__pyx_t_4 = NULL;
20727 PyObject *__pyx_t_5 = NULL;
20729 int __pyx_lineno = 0;
20730 const char *__pyx_filename = NULL;
20731 int __pyx_clineno = 0;
20732 __Pyx_RefNannySetupContext(
"__pyx_unpickle_Enum", 0);
20741 __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xb068931) != 0);
20751 __pyx_t_2 = PyList_New(1);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
20752 __Pyx_GOTREF(__pyx_t_2);
20753 __Pyx_INCREF(__pyx_n_s_PickleError);
20754 __Pyx_GIVEREF(__pyx_n_s_PickleError);
20755 PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError);
20756 __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, 0);
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error)
20757 __Pyx_GOTREF(__pyx_t_3);
20758 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20759 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error)
20760 __Pyx_GOTREF(__pyx_t_2);
20761 __Pyx_INCREF(__pyx_t_2);
20762 __pyx_v___pyx_PickleError = __pyx_t_2;
20763 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20764 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
20773 __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error)
20774 __Pyx_GOTREF(__pyx_t_2);
20775 __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_t_2);
if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error)
20776 __Pyx_GOTREF(__pyx_t_4);
20777 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20778 __Pyx_INCREF(__pyx_v___pyx_PickleError);
20779 __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL;
20780 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
20781 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
20782 if (likely(__pyx_t_5)) {
20783 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_2);
20784 __Pyx_INCREF(__pyx_t_5);
20785 __Pyx_INCREF(
function);
20786 __Pyx_DECREF_SET(__pyx_t_2,
function);
20789 __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4);
20790 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
20791 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
20792 if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error)
20793 __Pyx_GOTREF(__pyx_t_3);
20794 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20795 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
20796 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
20797 __PYX_ERR(1, 6, __pyx_L1_error)
20815 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new);
if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error)
20816 __Pyx_GOTREF(__pyx_t_2);
20818 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
20819 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
20820 if (likely(__pyx_t_4)) {
20821 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_2);
20822 __Pyx_INCREF(__pyx_t_4);
20823 __Pyx_INCREF(
function);
20824 __Pyx_DECREF_SET(__pyx_t_2,
function);
20827 __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type);
20828 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
20829 if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error)
20830 __Pyx_GOTREF(__pyx_t_3);
20831 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
20832 __pyx_v___pyx_result = __pyx_t_3;
20842 __pyx_t_1 = (__pyx_v___pyx_state != Py_None);
20843 __pyx_t_6 = (__pyx_t_1 != 0);
20853 if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError,
"Expected %.16s, got %.200s",
"tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error)
20854 __pyx_t_3 = __pyx_unpickle_Enum__set_state(((
struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state));
if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error)
20855 __Pyx_GOTREF(__pyx_t_3);
20856 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
20874 __Pyx_XDECREF(__pyx_r);
20875 __Pyx_INCREF(__pyx_v___pyx_result);
20876 __pyx_r = __pyx_v___pyx_result;
20887 __Pyx_XDECREF(__pyx_t_2);
20888 __Pyx_XDECREF(__pyx_t_3);
20889 __Pyx_XDECREF(__pyx_t_4);
20890 __Pyx_XDECREF(__pyx_t_5);
20891 __Pyx_AddTraceback(
"View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
20894 __Pyx_XDECREF(__pyx_v___pyx_PickleError);
20895 __Pyx_XDECREF(__pyx_v___pyx_result);
20896 __Pyx_XGIVEREF(__pyx_r);
20897 __Pyx_RefNannyFinishContext();
20909 static PyObject *__pyx_unpickle_Enum__set_state(
struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
20910 PyObject *__pyx_r = NULL;
20911 __Pyx_RefNannyDeclarations
20912 PyObject *__pyx_t_1 = NULL;
20914 Py_ssize_t __pyx_t_3;
20917 PyObject *__pyx_t_6 = NULL;
20918 PyObject *__pyx_t_7 = NULL;
20919 PyObject *__pyx_t_8 = NULL;
20920 int __pyx_lineno = 0;
20921 const char *__pyx_filename = NULL;
20922 int __pyx_clineno = 0;
20923 __Pyx_RefNannySetupContext(
"__pyx_unpickle_Enum__set_state", 0);
20932 if (unlikely(__pyx_v___pyx_state == Py_None)) {
20933 PyErr_SetString(PyExc_TypeError,
"'NoneType' object is not subscriptable");
20934 __PYX_ERR(1, 12, __pyx_L1_error)
20936 __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0,
long, 1, __Pyx_PyInt_From_long, 0, 0, 1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 12, __pyx_L1_error)
20937 __Pyx_GOTREF(__pyx_t_1);
20938 __Pyx_GIVEREF(__pyx_t_1);
20939 __Pyx_GOTREF(__pyx_v___pyx_result->name);
20940 __Pyx_DECREF(__pyx_v___pyx_result->name);
20941 __pyx_v___pyx_result->name = __pyx_t_1;
20950 if (unlikely(__pyx_v___pyx_state == Py_None)) {
20951 PyErr_SetString(PyExc_TypeError,
"object of type 'NoneType' has no len()");
20952 __PYX_ERR(1, 13, __pyx_L1_error)
20954 __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state);
if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
20955 __pyx_t_4 = ((__pyx_t_3 > 1) != 0);
20958 __pyx_t_2 = __pyx_t_4;
20959 goto __pyx_L4_bool_binop_done;
20961 __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict);
if (unlikely(__pyx_t_4 == ((
int)-1))) __PYX_ERR(1, 13, __pyx_L1_error)
20962 __pyx_t_5 = (__pyx_t_4 != 0);
20963 __pyx_t_2 = __pyx_t_5;
20964 __pyx_L4_bool_binop_done:;
20972 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
20973 __Pyx_GOTREF(__pyx_t_6);
20974 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update);
if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 14, __pyx_L1_error)
20975 __Pyx_GOTREF(__pyx_t_7);
20976 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
20977 if (unlikely(__pyx_v___pyx_state == Py_None)) {
20978 PyErr_SetString(PyExc_TypeError,
"'NoneType' object is not subscriptable");
20979 __PYX_ERR(1, 14, __pyx_L1_error)
20981 __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1,
long, 1, __Pyx_PyInt_From_long, 0, 0, 1);
if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 14, __pyx_L1_error)
20982 __Pyx_GOTREF(__pyx_t_6);
20984 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
20985 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
20986 if (likely(__pyx_t_8)) {
20987 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_7);
20988 __Pyx_INCREF(__pyx_t_8);
20989 __Pyx_INCREF(
function);
20990 __Pyx_DECREF_SET(__pyx_t_7,
function);
20993 __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
20994 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
20995 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
20996 if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
20997 __Pyx_GOTREF(__pyx_t_1);
20998 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
20999 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21018 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
21021 __Pyx_XDECREF(__pyx_t_1);
21022 __Pyx_XDECREF(__pyx_t_6);
21023 __Pyx_XDECREF(__pyx_t_7);
21024 __Pyx_XDECREF(__pyx_t_8);
21025 __Pyx_AddTraceback(
"View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
21028 __Pyx_XGIVEREF(__pyx_r);
21029 __Pyx_RefNannyFinishContext();
21033 static PyObject *__pyx_tp_new_10csmoothers_cASMFactor(PyTypeObject *t, PyObject *a, PyObject *k) {
21035 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
21036 o = (*t->tp_alloc)(t, 0);
21038 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
21040 if (unlikely(!o))
return 0;
21041 if (unlikely(__pyx_pw_10csmoothers_10cASMFactor_1__cinit__(o, a, k) < 0))
goto bad;
21044 Py_DECREF(o); o = 0;
21048 static void __pyx_tp_dealloc_10csmoothers_cASMFactor(PyObject *o) {
21049 #if CYTHON_USE_TP_FINALIZE
21050 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
21051 if (PyObject_CallFinalizerFromDealloc(o))
return;
21055 PyObject *etype, *eval, *etb;
21056 PyErr_Fetch(&etype, &eval, &etb);
21057 __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
21058 __pyx_pw_10csmoothers_10cASMFactor_3__dealloc__(o);
21059 __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
21060 PyErr_Restore(etype, eval, etb);
21062 (*Py_TYPE(o)->tp_free)(o);
21065 static PyMethodDef __pyx_methods_10csmoothers_cASMFactor[] = {
21066 {
"__reduce_cython__", (PyCFunction)__pyx_pw_10csmoothers_10cASMFactor_5__reduce_cython__, METH_NOARGS, 0},
21067 {
"__setstate_cython__", (PyCFunction)__pyx_pw_10csmoothers_10cASMFactor_7__setstate_cython__, METH_O, 0},
21071 static PyTypeObject __pyx_type_10csmoothers_cASMFactor = {
21072 PyVarObject_HEAD_INIT(0, 0)
21073 "csmoothers.cASMFactor",
21074 sizeof(
struct __pyx_obj_10csmoothers_cASMFactor),
21076 __pyx_tp_dealloc_10csmoothers_cASMFactor,
21077 #
if PY_VERSION_HEX < 0x030800b4
21080 #
if PY_VERSION_HEX >= 0x030800b4
21085 #
if PY_MAJOR_VERSION < 3
21088 #
if PY_MAJOR_VERSION >= 3
21101 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
21109 __pyx_methods_10csmoothers_cASMFactor,
21119 __pyx_tp_new_10csmoothers_cASMFactor,
21129 #
if PY_VERSION_HEX >= 0x030400a1
21132 #
if PY_VERSION_HEX >= 0x030800b1
21135 #
if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
21140 static PyObject *__pyx_tp_new_10csmoothers_cBASMFactor(PyTypeObject *t, PyObject *a, PyObject *k) {
21142 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
21143 o = (*t->tp_alloc)(t, 0);
21145 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
21147 if (unlikely(!o))
return 0;
21148 if (unlikely(__pyx_pw_10csmoothers_11cBASMFactor_1__cinit__(o, a, k) < 0))
goto bad;
21151 Py_DECREF(o); o = 0;
21155 static void __pyx_tp_dealloc_10csmoothers_cBASMFactor(PyObject *o) {
21156 #if CYTHON_USE_TP_FINALIZE
21157 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
21158 if (PyObject_CallFinalizerFromDealloc(o))
return;
21162 PyObject *etype, *eval, *etb;
21163 PyErr_Fetch(&etype, &eval, &etb);
21164 __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
21165 __pyx_pw_10csmoothers_11cBASMFactor_3__dealloc__(o);
21166 __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
21167 PyErr_Restore(etype, eval, etb);
21169 (*Py_TYPE(o)->tp_free)(o);
21172 static PyMethodDef __pyx_methods_10csmoothers_cBASMFactor[] = {
21173 {
"__reduce_cython__", (PyCFunction)__pyx_pw_10csmoothers_11cBASMFactor_5__reduce_cython__, METH_NOARGS, 0},
21174 {
"__setstate_cython__", (PyCFunction)__pyx_pw_10csmoothers_11cBASMFactor_7__setstate_cython__, METH_O, 0},
21178 static PyTypeObject __pyx_type_10csmoothers_cBASMFactor = {
21179 PyVarObject_HEAD_INIT(0, 0)
21180 "csmoothers.cBASMFactor",
21181 sizeof(
struct __pyx_obj_10csmoothers_cBASMFactor),
21183 __pyx_tp_dealloc_10csmoothers_cBASMFactor,
21184 #
if PY_VERSION_HEX < 0x030800b4
21187 #
if PY_VERSION_HEX >= 0x030800b4
21192 #
if PY_MAJOR_VERSION < 3
21195 #
if PY_MAJOR_VERSION >= 3
21208 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
21216 __pyx_methods_10csmoothers_cBASMFactor,
21226 __pyx_tp_new_10csmoothers_cBASMFactor,
21236 #
if PY_VERSION_HEX >= 0x030400a1
21239 #
if PY_VERSION_HEX >= 0x030800b1
21242 #
if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
21246 static struct __pyx_vtabstruct_array __pyx_vtable_array;
21248 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
21249 struct __pyx_array_obj *p;
21251 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
21252 o = (*t->tp_alloc)(t, 0);
21254 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
21256 if (unlikely(!o))
return 0;
21257 p = ((
struct __pyx_array_obj *)o);
21258 p->__pyx_vtab = __pyx_vtabptr_array;
21259 p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
21260 p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
21261 if (unlikely(__pyx_array___cinit__(o, a, k) < 0))
goto bad;
21264 Py_DECREF(o); o = 0;
21268 static void __pyx_tp_dealloc_array(PyObject *o) {
21269 struct __pyx_array_obj *p = (
struct __pyx_array_obj *)o;
21270 #if CYTHON_USE_TP_FINALIZE
21271 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
21272 if (PyObject_CallFinalizerFromDealloc(o))
return;
21276 PyObject *etype, *eval, *etb;
21277 PyErr_Fetch(&etype, &eval, &etb);
21278 __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
21279 __pyx_array___dealloc__(o);
21280 __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
21281 PyErr_Restore(etype, eval, etb);
21284 Py_CLEAR(p->_format);
21285 (*Py_TYPE(o)->tp_free)(o);
21287 static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
21289 PyObject *x = PyInt_FromSsize_t(i);
if(!x)
return 0;
21290 r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
21295 static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *
v) {
21297 return __pyx_array___setitem__(o, i,
v);
21300 PyErr_Format(PyExc_NotImplementedError,
21301 "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
21306 static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *
n) {
21307 PyObject *
v = __Pyx_PyObject_GenericGetAttr(o,
n);
21308 if (!
v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
21310 v = __pyx_array___getattr__(o,
n);
21315 static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED
void *x) {
21316 return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o);
21319 static PyMethodDef __pyx_methods_array[] = {
21320 {
"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0},
21321 {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_array_1__reduce_cython__, METH_NOARGS, 0},
21322 {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_array_3__setstate_cython__, METH_O, 0},
21326 static struct PyGetSetDef __pyx_getsets_array[] = {
21327 {(
char *)
"memview", __pyx_getprop___pyx_array_memview, 0, (
char *)0, 0},
21331 static PySequenceMethods __pyx_tp_as_sequence_array = {
21332 __pyx_array___len__,
21335 __pyx_sq_item_array,
21344 static PyMappingMethods __pyx_tp_as_mapping_array = {
21345 __pyx_array___len__,
21346 __pyx_array___getitem__,
21347 __pyx_mp_ass_subscript_array,
21350 static PyBufferProcs __pyx_tp_as_buffer_array = {
21351 #if PY_MAJOR_VERSION < 3
21354 #if PY_MAJOR_VERSION < 3
21357 #if PY_MAJOR_VERSION < 3
21360 #if PY_MAJOR_VERSION < 3
21363 __pyx_array_getbuffer,
21367 static PyTypeObject __pyx_type___pyx_array = {
21368 PyVarObject_HEAD_INIT(0, 0)
21369 "csmoothers.array",
21370 sizeof(
struct __pyx_array_obj),
21372 __pyx_tp_dealloc_array,
21373 #
if PY_VERSION_HEX < 0x030800b4
21376 #
if PY_VERSION_HEX >= 0x030800b4
21381 #
if PY_MAJOR_VERSION < 3
21384 #
if PY_MAJOR_VERSION >= 3
21389 &__pyx_tp_as_sequence_array,
21390 &__pyx_tp_as_mapping_array,
21394 __pyx_tp_getattro_array,
21396 &__pyx_tp_as_buffer_array,
21397 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
21405 __pyx_methods_array,
21407 __pyx_getsets_array,
21415 __pyx_tp_new_array,
21425 #
if PY_VERSION_HEX >= 0x030400a1
21428 #
if PY_VERSION_HEX >= 0x030800b1
21431 #
if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
21436 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
21437 struct __pyx_MemviewEnum_obj *p;
21439 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
21440 o = (*t->tp_alloc)(t, 0);
21442 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
21444 if (unlikely(!o))
return 0;
21445 p = ((
struct __pyx_MemviewEnum_obj *)o);
21446 p->name = Py_None; Py_INCREF(Py_None);
21450 static void __pyx_tp_dealloc_Enum(PyObject *o) {
21451 struct __pyx_MemviewEnum_obj *p = (
struct __pyx_MemviewEnum_obj *)o;
21452 #if CYTHON_USE_TP_FINALIZE
21453 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
21454 if (PyObject_CallFinalizerFromDealloc(o))
return;
21457 PyObject_GC_UnTrack(o);
21459 (*Py_TYPE(o)->tp_free)(o);
21462 static int __pyx_tp_traverse_Enum(PyObject *o, visitproc
v,
void *a) {
21464 struct __pyx_MemviewEnum_obj *p = (
struct __pyx_MemviewEnum_obj *)o;
21466 e = (*v)(p->name, a);
if (e)
return e;
21471 static int __pyx_tp_clear_Enum(PyObject *o) {
21473 struct __pyx_MemviewEnum_obj *p = (
struct __pyx_MemviewEnum_obj *)o;
21474 tmp = ((PyObject*)p->name);
21475 p->name = Py_None; Py_INCREF(Py_None);
21480 static PyMethodDef __pyx_methods_Enum[] = {
21481 {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, METH_NOARGS, 0},
21482 {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, METH_O, 0},
21486 static PyTypeObject __pyx_type___pyx_MemviewEnum = {
21487 PyVarObject_HEAD_INIT(0, 0)
21489 sizeof(
struct __pyx_MemviewEnum_obj),
21491 __pyx_tp_dealloc_Enum,
21492 #
if PY_VERSION_HEX < 0x030800b4
21495 #
if PY_VERSION_HEX >= 0x030800b4
21500 #
if PY_MAJOR_VERSION < 3
21503 #
if PY_MAJOR_VERSION >= 3
21506 __pyx_MemviewEnum___repr__,
21516 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
21518 __pyx_tp_traverse_Enum,
21519 __pyx_tp_clear_Enum,
21524 __pyx_methods_Enum,
21532 __pyx_MemviewEnum___init__,
21544 #
if PY_VERSION_HEX >= 0x030400a1
21547 #
if PY_VERSION_HEX >= 0x030800b1
21550 #
if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
21554 static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
21556 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
21557 struct __pyx_memoryview_obj *p;
21559 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
21560 o = (*t->tp_alloc)(t, 0);
21562 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
21564 if (unlikely(!o))
return 0;
21565 p = ((
struct __pyx_memoryview_obj *)o);
21566 p->__pyx_vtab = __pyx_vtabptr_memoryview;
21567 p->obj = Py_None; Py_INCREF(Py_None);
21568 p->_size = Py_None; Py_INCREF(Py_None);
21569 p->_array_interface = Py_None; Py_INCREF(Py_None);
21570 p->view.obj = NULL;
21571 if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0))
goto bad;
21574 Py_DECREF(o); o = 0;
21578 static void __pyx_tp_dealloc_memoryview(PyObject *o) {
21579 struct __pyx_memoryview_obj *p = (
struct __pyx_memoryview_obj *)o;
21580 #if CYTHON_USE_TP_FINALIZE
21581 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
21582 if (PyObject_CallFinalizerFromDealloc(o))
return;
21585 PyObject_GC_UnTrack(o);
21587 PyObject *etype, *eval, *etb;
21588 PyErr_Fetch(&etype, &eval, &etb);
21589 __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
21590 __pyx_memoryview___dealloc__(o);
21591 __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
21592 PyErr_Restore(etype, eval, etb);
21595 Py_CLEAR(p->_size);
21596 Py_CLEAR(p->_array_interface);
21597 (*Py_TYPE(o)->tp_free)(o);
21600 static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc
v,
void *a) {
21602 struct __pyx_memoryview_obj *p = (
struct __pyx_memoryview_obj *)o;
21604 e = (*v)(p->obj, a);
if (e)
return e;
21607 e = (*v)(p->_size, a);
if (e)
return e;
21609 if (p->_array_interface) {
21610 e = (*v)(p->_array_interface, a);
if (e)
return e;
21613 e = (*v)(p->view.obj, a);
if (e)
return e;
21618 static int __pyx_tp_clear_memoryview(PyObject *o) {
21620 struct __pyx_memoryview_obj *p = (
struct __pyx_memoryview_obj *)o;
21621 tmp = ((PyObject*)p->obj);
21622 p->obj = Py_None; Py_INCREF(Py_None);
21624 tmp = ((PyObject*)p->_size);
21625 p->_size = Py_None; Py_INCREF(Py_None);
21627 tmp = ((PyObject*)p->_array_interface);
21628 p->_array_interface = Py_None; Py_INCREF(Py_None);
21630 Py_CLEAR(p->view.obj);
21633 static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
21635 PyObject *x = PyInt_FromSsize_t(i);
if(!x)
return 0;
21636 r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
21641 static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *
v) {
21643 return __pyx_memoryview___setitem__(o, i,
v);
21646 PyErr_Format(PyExc_NotImplementedError,
21647 "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
21652 static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED
void *x) {
21653 return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o);
21656 static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED
void *x) {
21657 return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o);
21660 static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED
void *x) {
21661 return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o);
21664 static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED
void *x) {
21665 return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o);
21668 static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED
void *x) {
21669 return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o);
21672 static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED
void *x) {
21673 return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o);
21676 static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED
void *x) {
21677 return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o);
21680 static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED
void *x) {
21681 return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o);
21684 static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED
void *x) {
21685 return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o);
21688 static PyMethodDef __pyx_methods_memoryview[] = {
21689 {
"is_c_contig", (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, 0},
21690 {
"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0},
21691 {
"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0},
21692 {
"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0},
21693 {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_1__reduce_cython__, METH_NOARGS, 0},
21694 {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_3__setstate_cython__, METH_O, 0},
21698 static struct PyGetSetDef __pyx_getsets_memoryview[] = {
21699 {(
char *)
"T", __pyx_getprop___pyx_memoryview_T, 0, (
char *)0, 0},
21700 {(
char *)
"base", __pyx_getprop___pyx_memoryview_base, 0, (
char *)0, 0},
21701 {(
char *)
"shape", __pyx_getprop___pyx_memoryview_shape, 0, (
char *)0, 0},
21702 {(
char *)
"strides", __pyx_getprop___pyx_memoryview_strides, 0, (
char *)0, 0},
21703 {(
char *)
"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, (
char *)0, 0},
21704 {(
char *)
"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, (
char *)0, 0},
21705 {(
char *)
"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, (
char *)0, 0},
21706 {(
char *)
"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, (
char *)0, 0},
21707 {(
char *)
"size", __pyx_getprop___pyx_memoryview_size, 0, (
char *)0, 0},
21711 static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
21712 __pyx_memoryview___len__,
21715 __pyx_sq_item_memoryview,
21724 static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
21725 __pyx_memoryview___len__,
21726 __pyx_memoryview___getitem__,
21727 __pyx_mp_ass_subscript_memoryview,
21730 static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
21731 #if PY_MAJOR_VERSION < 3
21734 #if PY_MAJOR_VERSION < 3
21737 #if PY_MAJOR_VERSION < 3
21740 #if PY_MAJOR_VERSION < 3
21743 __pyx_memoryview_getbuffer,
21747 static PyTypeObject __pyx_type___pyx_memoryview = {
21748 PyVarObject_HEAD_INIT(0, 0)
21749 "csmoothers.memoryview",
21750 sizeof(
struct __pyx_memoryview_obj),
21752 __pyx_tp_dealloc_memoryview,
21753 #
if PY_VERSION_HEX < 0x030800b4
21756 #
if PY_VERSION_HEX >= 0x030800b4
21761 #
if PY_MAJOR_VERSION < 3
21764 #
if PY_MAJOR_VERSION >= 3
21767 __pyx_memoryview___repr__,
21769 &__pyx_tp_as_sequence_memoryview,
21770 &__pyx_tp_as_mapping_memoryview,
21773 __pyx_memoryview___str__,
21776 &__pyx_tp_as_buffer_memoryview,
21777 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
21779 __pyx_tp_traverse_memoryview,
21780 __pyx_tp_clear_memoryview,
21785 __pyx_methods_memoryview,
21787 __pyx_getsets_memoryview,
21795 __pyx_tp_new_memoryview,
21805 #
if PY_VERSION_HEX >= 0x030400a1
21808 #
if PY_VERSION_HEX >= 0x030800b1
21811 #
if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
21815 static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;
21817 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) {
21818 struct __pyx_memoryviewslice_obj *p;
21819 PyObject *o = __pyx_tp_new_memoryview(t, a, k);
21820 if (unlikely(!o))
return 0;
21821 p = ((
struct __pyx_memoryviewslice_obj *)o);
21822 p->__pyx_base.__pyx_vtab = (
struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice;
21823 p->from_object = Py_None; Py_INCREF(Py_None);
21824 p->from_slice.memview = NULL;
21828 static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
21829 struct __pyx_memoryviewslice_obj *p = (
struct __pyx_memoryviewslice_obj *)o;
21830 #if CYTHON_USE_TP_FINALIZE
21831 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
21832 if (PyObject_CallFinalizerFromDealloc(o))
return;
21835 PyObject_GC_UnTrack(o);
21837 PyObject *etype, *eval, *etb;
21838 PyErr_Fetch(&etype, &eval, &etb);
21839 __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
21840 __pyx_memoryviewslice___dealloc__(o);
21841 __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
21842 PyErr_Restore(etype, eval, etb);
21844 Py_CLEAR(p->from_object);
21845 PyObject_GC_Track(o);
21846 __pyx_tp_dealloc_memoryview(o);
21849 static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc
v,
void *a) {
21851 struct __pyx_memoryviewslice_obj *p = (
struct __pyx_memoryviewslice_obj *)o;
21852 e = __pyx_tp_traverse_memoryview(o,
v, a);
if (e)
return e;
21853 if (p->from_object) {
21854 e = (*v)(p->from_object, a);
if (e)
return e;
21859 static int __pyx_tp_clear__memoryviewslice(PyObject *o) {
21861 struct __pyx_memoryviewslice_obj *p = (
struct __pyx_memoryviewslice_obj *)o;
21862 __pyx_tp_clear_memoryview(o);
21863 tmp = ((PyObject*)p->from_object);
21864 p->from_object = Py_None; Py_INCREF(Py_None);
21866 __PYX_XDEC_MEMVIEW(&p->from_slice, 1);
21870 static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED
void *x) {
21871 return __pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(o);
21874 static PyMethodDef __pyx_methods__memoryviewslice[] = {
21875 {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, METH_NOARGS, 0},
21876 {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, METH_O, 0},
21880 static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
21881 {(
char *)
"base", __pyx_getprop___pyx_memoryviewslice_base, 0, (
char *)0, 0},
21885 static PyTypeObject __pyx_type___pyx_memoryviewslice = {
21886 PyVarObject_HEAD_INIT(0, 0)
21887 "csmoothers._memoryviewslice",
21888 sizeof(
struct __pyx_memoryviewslice_obj),
21890 __pyx_tp_dealloc__memoryviewslice,
21891 #
if PY_VERSION_HEX < 0x030800b4
21894 #
if PY_VERSION_HEX >= 0x030800b4
21899 #
if PY_MAJOR_VERSION < 3
21902 #
if PY_MAJOR_VERSION >= 3
21905 #
if CYTHON_COMPILING_IN_PYPY
21906 __pyx_memoryview___repr__,
21915 #
if CYTHON_COMPILING_IN_PYPY
21916 __pyx_memoryview___str__,
21923 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
21924 "Internal class for passing memoryview slices to Python",
21925 __pyx_tp_traverse__memoryviewslice,
21926 __pyx_tp_clear__memoryviewslice,
21931 __pyx_methods__memoryviewslice,
21933 __pyx_getsets__memoryviewslice,
21941 __pyx_tp_new__memoryviewslice,
21951 #
if PY_VERSION_HEX >= 0x030400a1
21954 #
if PY_VERSION_HEX >= 0x030800b1
21957 #
if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
21962 static PyMethodDef __pyx_methods[] = {
21966 #if PY_MAJOR_VERSION >= 3
21967 #if CYTHON_PEP489_MULTI_PHASE_INIT
21968 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def);
21969 static int __pyx_pymod_exec_csmoothers(PyObject* module);
21970 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
21971 {Py_mod_create, (
void*)__pyx_pymod_create},
21972 {Py_mod_exec, (
void*)__pyx_pymod_exec_csmoothers},
21977 static struct PyModuleDef __pyx_moduledef = {
21978 PyModuleDef_HEAD_INIT,
21981 #if CYTHON_PEP489_MULTI_PHASE_INIT
21987 #if CYTHON_PEP489_MULTI_PHASE_INIT
21988 __pyx_moduledef_slots,
21997 #ifndef CYTHON_SMALL_CODE
21998 #if defined(__clang__)
21999 #define CYTHON_SMALL_CODE
22000 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
22001 #define CYTHON_SMALL_CODE __attribute__((cold))
22003 #define CYTHON_SMALL_CODE
22007 static __Pyx_StringTabEntry __pyx_string_tab[] = {
22008 {&__pyx_n_s_A, __pyx_k_A,
sizeof(__pyx_k_A), 0, 0, 1, 1},
22009 {&__pyx_n_s_ASCII, __pyx_k_ASCII,
sizeof(__pyx_k_ASCII), 0, 0, 1, 1},
22010 {&__pyx_n_s_ASMFactor, __pyx_k_ASMFactor,
sizeof(__pyx_k_ASMFactor), 0, 0, 1, 1},
22011 {&__pyx_n_s_ASMFactor___init, __pyx_k_ASMFactor___init,
sizeof(__pyx_k_ASMFactor___init), 0, 0, 1, 1},
22012 {&__pyx_n_s_BASMFactor, __pyx_k_BASMFactor,
sizeof(__pyx_k_BASMFactor), 0, 0, 1, 1},
22013 {&__pyx_n_s_BASMFactor___init, __pyx_k_BASMFactor___init,
sizeof(__pyx_k_BASMFactor___init), 0, 0, 1, 1},
22014 {&__pyx_kp_s_Buffer_view_does_not_expose_stri, __pyx_k_Buffer_view_does_not_expose_stri,
sizeof(__pyx_k_Buffer_view_does_not_expose_stri), 0, 0, 1, 0},
22015 {&__pyx_kp_s_Can_only_create_a_buffer_that_is, __pyx_k_Can_only_create_a_buffer_that_is,
sizeof(__pyx_k_Can_only_create_a_buffer_that_is), 0, 0, 1, 0},
22016 {&__pyx_kp_s_Cannot_assign_to_read_only_memor, __pyx_k_Cannot_assign_to_read_only_memor,
sizeof(__pyx_k_Cannot_assign_to_read_only_memor), 0, 0, 1, 0},
22017 {&__pyx_kp_s_Cannot_create_writable_memory_vi, __pyx_k_Cannot_create_writable_memory_vi,
sizeof(__pyx_k_Cannot_create_writable_memory_vi), 0, 0, 1, 0},
22018 {&__pyx_kp_s_Cannot_index_with_type_s, __pyx_k_Cannot_index_with_type_s,
sizeof(__pyx_k_Cannot_index_with_type_s), 0, 0, 1, 0},
22019 {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis,
sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1},
22020 {&__pyx_kp_s_Empty_shape_tuple_for_cython_arr, __pyx_k_Empty_shape_tuple_for_cython_arr,
sizeof(__pyx_k_Empty_shape_tuple_for_cython_arr), 0, 0, 1, 0},
22021 {&__pyx_n_s_ImportError, __pyx_k_ImportError,
sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
22022 {&__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_k_Incompatible_checksums_s_vs_0xb0,
sizeof(__pyx_k_Incompatible_checksums_s_vs_0xb0), 0, 0, 1, 0},
22023 {&__pyx_n_s_IndexError, __pyx_k_IndexError,
sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
22024 {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte,
sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0},
22025 {&__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_k_Invalid_mode_expected_c_or_fortr,
sizeof(__pyx_k_Invalid_mode_expected_c_or_fortr), 0, 0, 1, 0},
22026 {&__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_k_Invalid_shape_in_axis_d_d,
sizeof(__pyx_k_Invalid_shape_in_axis_d_d), 0, 0, 1, 0},
22027 {&__pyx_n_s_L, __pyx_k_L,
sizeof(__pyx_k_L), 0, 0, 1, 1},
22028 {&__pyx_n_s_M, __pyx_k_M,
sizeof(__pyx_k_M), 0, 0, 1, 1},
22029 {&__pyx_n_s_MemoryError, __pyx_k_MemoryError,
sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
22030 {&__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_k_MemoryView_of_r_at_0x_x,
sizeof(__pyx_k_MemoryView_of_r_at_0x_x), 0, 0, 1, 0},
22031 {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object,
sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0},
22032 {&__pyx_n_b_O, __pyx_k_O,
sizeof(__pyx_k_O), 0, 0, 0, 1},
22033 {&__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_k_Out_of_bounds_on_buffer_access_a,
sizeof(__pyx_k_Out_of_bounds_on_buffer_access_a), 0, 0, 1, 0},
22034 {&__pyx_n_s_PickleError, __pyx_k_PickleError,
sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
22035 {&__pyx_n_s_R, __pyx_k_R,
sizeof(__pyx_k_R), 0, 0, 1, 1},
22036 {&__pyx_n_s_TypeError, __pyx_k_TypeError,
sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
22037 {&__pyx_kp_s_Unable_to_convert_item_to_object, __pyx_k_Unable_to_convert_item_to_object,
sizeof(__pyx_k_Unable_to_convert_item_to_object), 0, 0, 1, 0},
22038 {&__pyx_n_s_ValueError, __pyx_k_ValueError,
sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
22039 {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView,
sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1},
22040 {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer,
sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1},
22041 {&__pyx_n_s_asmFactor, __pyx_k_asmFactor,
sizeof(__pyx_k_asmFactor), 0, 0, 1, 1},
22042 {&__pyx_n_s_asm_NR_prepare, __pyx_k_asm_NR_prepare,
sizeof(__pyx_k_asm_NR_prepare), 0, 0, 1, 1},
22043 {&__pyx_n_s_asm_NR_solve, __pyx_k_asm_NR_solve,
sizeof(__pyx_k_asm_NR_solve), 0, 0, 1, 1},
22044 {&__pyx_n_s_base, __pyx_k_base,
sizeof(__pyx_k_base), 0, 0, 1, 1},
22045 {&__pyx_n_s_basmFactor, __pyx_k_basmFactor,
sizeof(__pyx_k_basmFactor), 0, 0, 1, 1},
22046 {&__pyx_n_s_basm_NR_prepare, __pyx_k_basm_NR_prepare,
sizeof(__pyx_k_basm_NR_prepare), 0, 0, 1, 1},
22047 {&__pyx_n_s_basm_NR_solve, __pyx_k_basm_NR_solve,
sizeof(__pyx_k_basm_NR_solve), 0, 0, 1, 1},
22048 {&__pyx_n_s_bs, __pyx_k_bs,
sizeof(__pyx_k_bs), 0, 0, 1, 1},
22049 {&__pyx_n_s_c, __pyx_k_c,
sizeof(__pyx_k_c), 0, 0, 1, 1},
22050 {&__pyx_n_u_c, __pyx_k_c,
sizeof(__pyx_k_c), 0, 1, 0, 1},
22051 {&__pyx_n_s_cASMFactor, __pyx_k_cASMFactor,
sizeof(__pyx_k_cASMFactor), 0, 0, 1, 1},
22052 {&__pyx_n_s_cASMFactor_2, __pyx_k_cASMFactor_2,
sizeof(__pyx_k_cASMFactor_2), 0, 0, 1, 1},
22053 {&__pyx_n_s_cBASMFactor, __pyx_k_cBASMFactor,
sizeof(__pyx_k_cBASMFactor), 0, 0, 1, 1},
22054 {&__pyx_n_s_cBASMFactor_2, __pyx_k_cBASMFactor_2,
sizeof(__pyx_k_cBASMFactor_2), 0, 0, 1, 1},
22055 {&__pyx_n_s_cSparseMatrix, __pyx_k_cSparseMatrix,
sizeof(__pyx_k_cSparseMatrix), 0, 0, 1, 1},
22056 {&__pyx_n_s_class, __pyx_k_class,
sizeof(__pyx_k_class), 0, 0, 1, 1},
22057 {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback,
sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
22058 {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct,
sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0},
22059 {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect,
sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0},
22060 {&__pyx_n_s_csmoothers, __pyx_k_csmoothers,
sizeof(__pyx_k_csmoothers), 0, 0, 1, 1},
22061 {&__pyx_n_s_dX, __pyx_k_dX,
sizeof(__pyx_k_dX), 0, 0, 1, 1},
22062 {&__pyx_n_s_dict, __pyx_k_dict,
sizeof(__pyx_k_dict), 0, 0, 1, 1},
22063 {&__pyx_n_s_doc, __pyx_k_doc,
sizeof(__pyx_k_doc), 0, 0, 1, 1},
22064 {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object,
sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1},
22065 {&__pyx_n_s_encode, __pyx_k_encode,
sizeof(__pyx_k_encode), 0, 0, 1, 1},
22066 {&__pyx_n_s_enumerate, __pyx_k_enumerate,
sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
22067 {&__pyx_n_s_error, __pyx_k_error,
sizeof(__pyx_k_error), 0, 0, 1, 1},
22068 {&__pyx_n_s_flags, __pyx_k_flags,
sizeof(__pyx_k_flags), 0, 0, 1, 1},
22069 {&__pyx_n_s_format, __pyx_k_format,
sizeof(__pyx_k_format), 0, 0, 1, 1},
22070 {&__pyx_n_s_fortran, __pyx_k_fortran,
sizeof(__pyx_k_fortran), 0, 0, 1, 1},
22071 {&__pyx_n_u_fortran, __pyx_k_fortran,
sizeof(__pyx_k_fortran), 0, 1, 0, 1},
22072 {&__pyx_n_s_gauss_seidel_NR_preare, __pyx_k_gauss_seidel_NR_preare,
sizeof(__pyx_k_gauss_seidel_NR_preare), 0, 0, 1, 1},
22073 {&__pyx_n_s_gauss_seidel_NR_solve, __pyx_k_gauss_seidel_NR_solve,
sizeof(__pyx_k_gauss_seidel_NR_solve), 0, 0, 1, 1},
22074 {&__pyx_n_s_getstate, __pyx_k_getstate,
sizeof(__pyx_k_getstate), 0, 0, 1, 1},
22075 {&__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_k_got_differing_extents_in_dimensi,
sizeof(__pyx_k_got_differing_extents_in_dimensi), 0, 0, 1, 0},
22076 {&__pyx_n_s_id, __pyx_k_id,
sizeof(__pyx_k_id), 0, 0, 1, 1},
22077 {&__pyx_n_s_import, __pyx_k_import,
sizeof(__pyx_k_import), 0, 0, 1, 1},
22078 {&__pyx_n_s_init, __pyx_k_init,
sizeof(__pyx_k_init), 0, 0, 1, 1},
22079 {&__pyx_n_s_itemsize, __pyx_k_itemsize,
sizeof(__pyx_k_itemsize), 0, 0, 1, 1},
22080 {&__pyx_kp_s_itemsize_0_for_cython_array, __pyx_k_itemsize_0_for_cython_array,
sizeof(__pyx_k_itemsize_0_for_cython_array), 0, 0, 1, 0},
22081 {&__pyx_n_s_jacobi_NR_prepare, __pyx_k_jacobi_NR_prepare,
sizeof(__pyx_k_jacobi_NR_prepare), 0, 0, 1, 1},
22082 {&__pyx_n_s_jacobi_NR_solve, __pyx_k_jacobi_NR_solve,
sizeof(__pyx_k_jacobi_NR_solve), 0, 0, 1, 1},
22083 {&__pyx_n_s_main, __pyx_k_main,
sizeof(__pyx_k_main), 0, 0, 1, 1},
22084 {&__pyx_n_s_memview, __pyx_k_memview,
sizeof(__pyx_k_memview), 0, 0, 1, 1},
22085 {&__pyx_n_s_metaclass, __pyx_k_metaclass,
sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
22086 {&__pyx_n_s_mode, __pyx_k_mode,
sizeof(__pyx_k_mode), 0, 0, 1, 1},
22087 {&__pyx_n_s_module, __pyx_k_module,
sizeof(__pyx_k_module), 0, 0, 1, 1},
22088 {&__pyx_n_s_name, __pyx_k_name,
sizeof(__pyx_k_name), 0, 0, 1, 1},
22089 {&__pyx_n_s_name_2, __pyx_k_name_2,
sizeof(__pyx_k_name_2), 0, 0, 1, 1},
22090 {&__pyx_n_s_nc, __pyx_k_nc,
sizeof(__pyx_k_nc), 0, 0, 1, 1},
22091 {&__pyx_n_s_ndim, __pyx_k_ndim,
sizeof(__pyx_k_ndim), 0, 0, 1, 1},
22092 {&__pyx_n_s_new, __pyx_k_new,
sizeof(__pyx_k_new), 0, 0, 1, 1},
22093 {&__pyx_n_s_nl_gauss_seidel_NR_solve, __pyx_k_nl_gauss_seidel_NR_solve,
sizeof(__pyx_k_nl_gauss_seidel_NR_solve), 0, 0, 1, 1},
22094 {&__pyx_n_s_nl_jacobi_NR_solve, __pyx_k_nl_jacobi_NR_solve,
sizeof(__pyx_k_nl_jacobi_NR_solve), 0, 0, 1, 1},
22095 {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non,
sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0},
22096 {&__pyx_n_s_node_order, __pyx_k_node_order,
sizeof(__pyx_k_node_order), 0, 0, 1, 1},
22097 {&__pyx_n_s_np, __pyx_k_np,
sizeof(__pyx_k_np), 0, 0, 1, 1},
22098 {&__pyx_n_s_nr, __pyx_k_nr,
sizeof(__pyx_k_nr), 0, 0, 1, 1},
22099 {&__pyx_n_s_numpy, __pyx_k_numpy,
sizeof(__pyx_k_numpy), 0, 0, 1, 1},
22100 {&__pyx_kp_s_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to,
sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 0, 1, 0},
22101 {&__pyx_kp_s_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor,
sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 0, 1, 0},
22102 {&__pyx_n_s_obj, __pyx_k_obj,
sizeof(__pyx_k_obj), 0, 0, 1, 1},
22103 {&__pyx_n_s_object, __pyx_k_object,
sizeof(__pyx_k_object), 0, 0, 1, 1},
22104 {&__pyx_n_s_pack, __pyx_k_pack,
sizeof(__pyx_k_pack), 0, 0, 1, 1},
22105 {&__pyx_n_s_pickle, __pyx_k_pickle,
sizeof(__pyx_k_pickle), 0, 0, 1, 1},
22106 {&__pyx_n_s_prepare, __pyx_k_prepare,
sizeof(__pyx_k_prepare), 0, 0, 1, 1},
22107 {&__pyx_kp_s_proteus_csmoothers_pyx, __pyx_k_proteus_csmoothers_pyx,
sizeof(__pyx_k_proteus_csmoothers_pyx), 0, 0, 1, 0},
22108 {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError,
sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
22109 {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum,
sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
22110 {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer,
sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1},
22111 {&__pyx_n_s_pyx_result, __pyx_k_pyx_result,
sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
22112 {&__pyx_n_s_pyx_state, __pyx_k_pyx_state,
sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
22113 {&__pyx_n_s_pyx_type, __pyx_k_pyx_type,
sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
22114 {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum,
sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1},
22115 {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable,
sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
22116 {&__pyx_n_s_qualname, __pyx_k_qualname,
sizeof(__pyx_k_qualname), 0, 0, 1, 1},
22117 {&__pyx_n_s_range, __pyx_k_range,
sizeof(__pyx_k_range), 0, 0, 1, 1},
22118 {&__pyx_n_s_reduce, __pyx_k_reduce,
sizeof(__pyx_k_reduce), 0, 0, 1, 1},
22119 {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython,
sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
22120 {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex,
sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
22121 {&__pyx_n_s_self, __pyx_k_self,
sizeof(__pyx_k_self), 0, 0, 1, 1},
22122 {&__pyx_n_s_setstate, __pyx_k_setstate,
sizeof(__pyx_k_setstate), 0, 0, 1, 1},
22123 {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython,
sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
22124 {&__pyx_n_s_shape, __pyx_k_shape,
sizeof(__pyx_k_shape), 0, 0, 1, 1},
22125 {&__pyx_n_s_size, __pyx_k_size,
sizeof(__pyx_k_size), 0, 0, 1, 1},
22126 {&__pyx_n_s_start, __pyx_k_start,
sizeof(__pyx_k_start), 0, 0, 1, 1},
22127 {&__pyx_n_s_step, __pyx_k_step,
sizeof(__pyx_k_step), 0, 0, 1, 1},
22128 {&__pyx_n_s_stop, __pyx_k_stop,
sizeof(__pyx_k_stop), 0, 0, 1, 1},
22129 {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct,
sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0},
22130 {&__pyx_kp_s_strided_and_direct_or_indirect, __pyx_k_strided_and_direct_or_indirect,
sizeof(__pyx_k_strided_and_direct_or_indirect), 0, 0, 1, 0},
22131 {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect,
sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0},
22132 {&__pyx_kp_s_stringsource, __pyx_k_stringsource,
sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
22133 {&__pyx_n_s_struct, __pyx_k_struct,
sizeof(__pyx_k_struct), 0, 0, 1, 1},
22134 {&__pyx_n_s_test, __pyx_k_test,
sizeof(__pyx_k_test), 0, 0, 1, 1},
22135 {&__pyx_n_s_tol, __pyx_k_tol,
sizeof(__pyx_k_tol), 0, 0, 1, 1},
22136 {&__pyx_kp_s_unable_to_allocate_array_data, __pyx_k_unable_to_allocate_array_data,
sizeof(__pyx_k_unable_to_allocate_array_data), 0, 0, 1, 0},
22137 {&__pyx_kp_s_unable_to_allocate_shape_and_str, __pyx_k_unable_to_allocate_shape_and_str,
sizeof(__pyx_k_unable_to_allocate_shape_and_str), 0, 0, 1, 0},
22138 {&__pyx_n_s_unpack, __pyx_k_unpack,
sizeof(__pyx_k_unpack), 0, 0, 1, 1},
22139 {&__pyx_n_s_update, __pyx_k_update,
sizeof(__pyx_k_update), 0, 0, 1, 1},
22140 {&__pyx_n_s_w, __pyx_k_w,
sizeof(__pyx_k_w), 0, 0, 1, 1},
22141 {0, 0, 0, 0, 0, 0, 0}
22143 static CYTHON_SMALL_CODE
int __Pyx_InitCachedBuiltins(
void) {
22144 __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s_object);
if (!__pyx_builtin_object) __PYX_ERR(0, 5, __pyx_L1_error)
22145 __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError);
if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error)
22146 __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError);
if (!__pyx_builtin_ImportError) __PYX_ERR(2, 945, __pyx_L1_error)
22147 __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError);
if (!__pyx_builtin_ValueError) __PYX_ERR(1, 133, __pyx_L1_error)
22148 __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError);
if (!__pyx_builtin_MemoryError) __PYX_ERR(1, 148, __pyx_L1_error)
22149 __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate);
if (!__pyx_builtin_enumerate) __PYX_ERR(1, 151, __pyx_L1_error)
22150 __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range);
if (!__pyx_builtin_range) __PYX_ERR(1, 180, __pyx_L1_error)
22151 __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis);
if (!__pyx_builtin_Ellipsis) __PYX_ERR(1, 404, __pyx_L1_error)
22152 __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id);
if (!__pyx_builtin_id) __PYX_ERR(1, 613, __pyx_L1_error)
22153 __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError);
if (!__pyx_builtin_IndexError) __PYX_ERR(1, 832, __pyx_L1_error)
22159 static CYTHON_SMALL_CODE
int __Pyx_InitCachedConstants(
void) {
22160 __Pyx_RefNannyDeclarations
22161 __Pyx_RefNannySetupContext(
"__Pyx_InitCachedConstants", 0);
22169 __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple_)) __PYX_ERR(1, 2, __pyx_L1_error)
22170 __Pyx_GOTREF(__pyx_tuple_);
22171 __Pyx_GIVEREF(__pyx_tuple_);
22178 __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 4, __pyx_L1_error)
22179 __Pyx_GOTREF(__pyx_tuple__2);
22180 __Pyx_GIVEREF(__pyx_tuple__2);
22188 __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 2, __pyx_L1_error)
22189 __Pyx_GOTREF(__pyx_tuple__3);
22190 __Pyx_GIVEREF(__pyx_tuple__3);
22197 __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__4)) __PYX_ERR(1, 4, __pyx_L1_error)
22198 __Pyx_GOTREF(__pyx_tuple__4);
22199 __Pyx_GIVEREF(__pyx_tuple__4);
22208 __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to);
if (unlikely(!__pyx_tuple__5)) __PYX_ERR(2, 945, __pyx_L1_error)
22209 __Pyx_GOTREF(__pyx_tuple__5);
22210 __Pyx_GIVEREF(__pyx_tuple__5);
22219 __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor);
if (unlikely(!__pyx_tuple__6)) __PYX_ERR(2, 951, __pyx_L1_error)
22220 __Pyx_GOTREF(__pyx_tuple__6);
22221 __Pyx_GIVEREF(__pyx_tuple__6);
22230 __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr);
if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 133, __pyx_L1_error)
22231 __Pyx_GOTREF(__pyx_tuple__7);
22232 __Pyx_GIVEREF(__pyx_tuple__7);
22241 __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array);
if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 136, __pyx_L1_error)
22242 __Pyx_GOTREF(__pyx_tuple__8);
22243 __Pyx_GIVEREF(__pyx_tuple__8);
22252 __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str);
if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 148, __pyx_L1_error)
22253 __Pyx_GOTREF(__pyx_tuple__9);
22254 __Pyx_GIVEREF(__pyx_tuple__9);
22263 __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data);
if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 176, __pyx_L1_error)
22264 __Pyx_GOTREF(__pyx_tuple__10);
22265 __Pyx_GIVEREF(__pyx_tuple__10);
22274 __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is);
if (unlikely(!__pyx_tuple__11)) __PYX_ERR(1, 192, __pyx_L1_error)
22275 __Pyx_GOTREF(__pyx_tuple__11);
22276 __Pyx_GIVEREF(__pyx_tuple__11);
22284 __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__12)) __PYX_ERR(1, 2, __pyx_L1_error)
22285 __Pyx_GOTREF(__pyx_tuple__12);
22286 __Pyx_GIVEREF(__pyx_tuple__12);
22293 __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__13)) __PYX_ERR(1, 4, __pyx_L1_error)
22294 __Pyx_GOTREF(__pyx_tuple__13);
22295 __Pyx_GIVEREF(__pyx_tuple__13);
22304 __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_Cannot_assign_to_read_only_memor);
if (unlikely(!__pyx_tuple__14)) __PYX_ERR(1, 418, __pyx_L1_error)
22305 __Pyx_GOTREF(__pyx_tuple__14);
22306 __Pyx_GIVEREF(__pyx_tuple__14);
22315 __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object);
if (unlikely(!__pyx_tuple__15)) __PYX_ERR(1, 495, __pyx_L1_error)
22316 __Pyx_GOTREF(__pyx_tuple__15);
22317 __Pyx_GIVEREF(__pyx_tuple__15);
22326 __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_Cannot_create_writable_memory_vi);
if (unlikely(!__pyx_tuple__16)) __PYX_ERR(1, 520, __pyx_L1_error)
22327 __Pyx_GOTREF(__pyx_tuple__16);
22328 __Pyx_GIVEREF(__pyx_tuple__16);
22337 __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri);
if (unlikely(!__pyx_tuple__17)) __PYX_ERR(1, 570, __pyx_L1_error)
22338 __Pyx_GOTREF(__pyx_tuple__17);
22339 __Pyx_GIVEREF(__pyx_tuple__17);
22348 __pyx_tuple__18 = PyTuple_New(1);
if (unlikely(!__pyx_tuple__18)) __PYX_ERR(1, 577, __pyx_L1_error)
22349 __Pyx_GOTREF(__pyx_tuple__18);
22350 __Pyx_INCREF(__pyx_int_neg_1);
22351 __Pyx_GIVEREF(__pyx_int_neg_1);
22352 PyTuple_SET_ITEM(__pyx_tuple__18, 0, __pyx_int_neg_1);
22353 __Pyx_GIVEREF(__pyx_tuple__18);
22361 __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__19)) __PYX_ERR(1, 2, __pyx_L1_error)
22362 __Pyx_GOTREF(__pyx_tuple__19);
22363 __Pyx_GIVEREF(__pyx_tuple__19);
22370 __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__20)) __PYX_ERR(1, 4, __pyx_L1_error)
22371 __Pyx_GOTREF(__pyx_tuple__20);
22372 __Pyx_GIVEREF(__pyx_tuple__20);
22381 __pyx_slice__21 = PySlice_New(Py_None, Py_None, Py_None);
if (unlikely(!__pyx_slice__21)) __PYX_ERR(1, 682, __pyx_L1_error)
22382 __Pyx_GOTREF(__pyx_slice__21);
22383 __Pyx_GIVEREF(__pyx_slice__21);
22392 __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte);
if (unlikely(!__pyx_tuple__22)) __PYX_ERR(1, 703, __pyx_L1_error)
22393 __Pyx_GOTREF(__pyx_tuple__22);
22394 __Pyx_GIVEREF(__pyx_tuple__22);
22402 __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__23)) __PYX_ERR(1, 2, __pyx_L1_error)
22403 __Pyx_GOTREF(__pyx_tuple__23);
22404 __Pyx_GIVEREF(__pyx_tuple__23);
22411 __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__24)) __PYX_ERR(1, 4, __pyx_L1_error)
22412 __Pyx_GOTREF(__pyx_tuple__24);
22413 __Pyx_GIVEREF(__pyx_tuple__24);
22422 __pyx_tuple__25 = PyTuple_Pack(1, __pyx_builtin_object);
if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 5, __pyx_L1_error)
22423 __Pyx_GOTREF(__pyx_tuple__25);
22424 __Pyx_GIVEREF(__pyx_tuple__25);
22433 __pyx_tuple__26 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_L);
if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 7, __pyx_L1_error)
22434 __Pyx_GOTREF(__pyx_tuple__26);
22435 __Pyx_GIVEREF(__pyx_tuple__26);
22436 __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_csmoothers_pyx, __pyx_n_s_init, 7, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 7, __pyx_L1_error)
22445 __pyx_tuple__28 = PyTuple_Pack(1, __pyx_builtin_object);
if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 42, __pyx_L1_error)
22446 __Pyx_GOTREF(__pyx_tuple__28);
22447 __Pyx_GIVEREF(__pyx_tuple__28);
22456 __pyx_tuple__29 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_L, __pyx_n_s_bs);
if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 44, __pyx_L1_error)
22457 __Pyx_GOTREF(__pyx_tuple__29);
22458 __Pyx_GIVEREF(__pyx_tuple__29);
22459 __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_csmoothers_pyx, __pyx_n_s_init, 44, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 44, __pyx_L1_error)
22468 __pyx_tuple__31 = PyTuple_Pack(4, __pyx_n_s_A, __pyx_n_s_w, __pyx_n_s_tol, __pyx_n_s_M);
if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 84, __pyx_L1_error)
22469 __Pyx_GOTREF(__pyx_tuple__31);
22470 __Pyx_GIVEREF(__pyx_tuple__31);
22471 __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_csmoothers_pyx, __pyx_n_s_jacobi_NR_prepare, 84, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 84, __pyx_L1_error)
22480 __pyx_tuple__33 = PyTuple_Pack(5, __pyx_n_s_A, __pyx_n_s_M, __pyx_n_s_R, __pyx_n_s_node_order, __pyx_n_s_dX);
if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 109, __pyx_L1_error)
22481 __Pyx_GOTREF(__pyx_tuple__33);
22482 __Pyx_GIVEREF(__pyx_tuple__33);
22483 __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_csmoothers_pyx, __pyx_n_s_jacobi_NR_solve, 109, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 109, __pyx_L1_error)
22492 __pyx_tuple__35 = PyTuple_Pack(6, __pyx_n_s_A, __pyx_n_s_R, __pyx_n_s_node_order, __pyx_n_s_w, __pyx_n_s_tol, __pyx_n_s_dX);
if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 136, __pyx_L1_error)
22493 __Pyx_GOTREF(__pyx_tuple__35);
22494 __Pyx_GIVEREF(__pyx_tuple__35);
22495 __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(6, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_csmoothers_pyx, __pyx_n_s_nl_jacobi_NR_solve, 136, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 136, __pyx_L1_error)
22504 __pyx_tuple__37 = PyTuple_Pack(4, __pyx_n_s_A, __pyx_n_s_w, __pyx_n_s_tol, __pyx_n_s_M);
if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 165, __pyx_L1_error)
22505 __Pyx_GOTREF(__pyx_tuple__37);
22506 __Pyx_GIVEREF(__pyx_tuple__37);
22507 __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_csmoothers_pyx, __pyx_n_s_gauss_seidel_NR_preare, 165, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 165, __pyx_L1_error)
22516 __pyx_tuple__39 = PyTuple_Pack(5, __pyx_n_s_A, __pyx_n_s_M, __pyx_n_s_R, __pyx_n_s_node_order, __pyx_n_s_dX);
if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 190, __pyx_L1_error)
22517 __Pyx_GOTREF(__pyx_tuple__39);
22518 __Pyx_GIVEREF(__pyx_tuple__39);
22519 __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_csmoothers_pyx, __pyx_n_s_gauss_seidel_NR_solve, 190, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 190, __pyx_L1_error)
22528 __pyx_tuple__41 = PyTuple_Pack(6, __pyx_n_s_A, __pyx_n_s_R, __pyx_n_s_node_order, __pyx_n_s_w, __pyx_n_s_tol, __pyx_n_s_dX);
if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 217, __pyx_L1_error)
22529 __Pyx_GOTREF(__pyx_tuple__41);
22530 __Pyx_GIVEREF(__pyx_tuple__41);
22531 __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(6, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_csmoothers_pyx, __pyx_n_s_nl_gauss_seidel_NR_solve, 217, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(0, 217, __pyx_L1_error)
22540 __pyx_tuple__43 = PyTuple_Pack(2, __pyx_n_s_A, __pyx_n_s_asmFactor);
if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 251, __pyx_L1_error)
22541 __Pyx_GOTREF(__pyx_tuple__43);
22542 __Pyx_GIVEREF(__pyx_tuple__43);
22543 __pyx_codeobj__44 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_csmoothers_pyx, __pyx_n_s_asm_NR_prepare, 251, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__44)) __PYX_ERR(0, 251, __pyx_L1_error)
22552 __pyx_tuple__45 = PyTuple_Pack(6, __pyx_n_s_A, __pyx_n_s_w, __pyx_n_s_asmFactor, __pyx_n_s_node_order, __pyx_n_s_R, __pyx_n_s_dX);
if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 277, __pyx_L1_error)
22553 __Pyx_GOTREF(__pyx_tuple__45);
22554 __Pyx_GIVEREF(__pyx_tuple__45);
22555 __pyx_codeobj__46 = (PyObject*)__Pyx_PyCode_New(6, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__45, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_csmoothers_pyx, __pyx_n_s_asm_NR_solve, 277, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__46)) __PYX_ERR(0, 277, __pyx_L1_error)
22564 __pyx_tuple__47 = PyTuple_Pack(2, __pyx_n_s_A, __pyx_n_s_basmFactor);
if (unlikely(!__pyx_tuple__47)) __PYX_ERR(0, 321, __pyx_L1_error)
22565 __Pyx_GOTREF(__pyx_tuple__47);
22566 __Pyx_GIVEREF(__pyx_tuple__47);
22567 __pyx_codeobj__48 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__47, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_csmoothers_pyx, __pyx_n_s_basm_NR_prepare, 321, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__48)) __PYX_ERR(0, 321, __pyx_L1_error)
22576 __pyx_tuple__49 = PyTuple_Pack(6, __pyx_n_s_A, __pyx_n_s_w, __pyx_n_s_basmFactor, __pyx_n_s_node_order, __pyx_n_s_R, __pyx_n_s_dX);
if (unlikely(!__pyx_tuple__49)) __PYX_ERR(0, 350, __pyx_L1_error)
22577 __Pyx_GOTREF(__pyx_tuple__49);
22578 __Pyx_GIVEREF(__pyx_tuple__49);
22579 __pyx_codeobj__50 = (PyObject*)__Pyx_PyCode_New(6, 0, 6, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__49, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_proteus_csmoothers_pyx, __pyx_n_s_basm_NR_solve, 350, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__50)) __PYX_ERR(0, 350, __pyx_L1_error)
22588 __pyx_tuple__51 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect);
if (unlikely(!__pyx_tuple__51)) __PYX_ERR(1, 286, __pyx_L1_error)
22589 __Pyx_GOTREF(__pyx_tuple__51);
22590 __Pyx_GIVEREF(__pyx_tuple__51);
22599 __pyx_tuple__52 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct);
if (unlikely(!__pyx_tuple__52)) __PYX_ERR(1, 287, __pyx_L1_error)
22600 __Pyx_GOTREF(__pyx_tuple__52);
22601 __Pyx_GIVEREF(__pyx_tuple__52);
22610 __pyx_tuple__53 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect);
if (unlikely(!__pyx_tuple__53)) __PYX_ERR(1, 288, __pyx_L1_error)
22611 __Pyx_GOTREF(__pyx_tuple__53);
22612 __Pyx_GIVEREF(__pyx_tuple__53);
22621 __pyx_tuple__54 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct);
if (unlikely(!__pyx_tuple__54)) __PYX_ERR(1, 291, __pyx_L1_error)
22622 __Pyx_GOTREF(__pyx_tuple__54);
22623 __Pyx_GIVEREF(__pyx_tuple__54);
22632 __pyx_tuple__55 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect);
if (unlikely(!__pyx_tuple__55)) __PYX_ERR(1, 292, __pyx_L1_error)
22633 __Pyx_GOTREF(__pyx_tuple__55);
22634 __Pyx_GIVEREF(__pyx_tuple__55);
22641 __pyx_tuple__56 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result);
if (unlikely(!__pyx_tuple__56)) __PYX_ERR(1, 1, __pyx_L1_error)
22642 __Pyx_GOTREF(__pyx_tuple__56);
22643 __Pyx_GIVEREF(__pyx_tuple__56);
22644 __pyx_codeobj__57 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__57)) __PYX_ERR(1, 1, __pyx_L1_error)
22645 __Pyx_RefNannyFinishContext();
22648 __Pyx_RefNannyFinishContext();
22652 static CYTHON_SMALL_CODE
int __Pyx_InitGlobals(
void) {
22653 if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
22654 __pyx_int_0 = PyInt_FromLong(0);
if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
22655 __pyx_int_1 = PyInt_FromLong(1);
if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
22656 __pyx_int_184977713 = PyInt_FromLong(184977713
L);
if (unlikely(!__pyx_int_184977713)) __PYX_ERR(0, 1, __pyx_L1_error)
22657 __pyx_int_neg_1 = PyInt_FromLong(-1);
if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
22663 static CYTHON_SMALL_CODE
int __Pyx_modinit_global_init_code(
void);
22664 static CYTHON_SMALL_CODE
int __Pyx_modinit_variable_export_code(
void);
22665 static CYTHON_SMALL_CODE
int __Pyx_modinit_function_export_code(
void);
22666 static CYTHON_SMALL_CODE
int __Pyx_modinit_type_init_code(
void);
22667 static CYTHON_SMALL_CODE
int __Pyx_modinit_type_import_code(
void);
22668 static CYTHON_SMALL_CODE
int __Pyx_modinit_variable_import_code(
void);
22669 static CYTHON_SMALL_CODE
int __Pyx_modinit_function_import_code(
void);
22671 static int __Pyx_modinit_global_init_code(
void) {
22672 __Pyx_RefNannyDeclarations
22673 __Pyx_RefNannySetupContext(
"__Pyx_modinit_global_init_code", 0);
22675 generic = Py_None; Py_INCREF(Py_None);
22676 strided = Py_None; Py_INCREF(Py_None);
22677 indirect = Py_None; Py_INCREF(Py_None);
22678 contiguous = Py_None; Py_INCREF(Py_None);
22679 indirect_contiguous = Py_None; Py_INCREF(Py_None);
22680 __Pyx_RefNannyFinishContext();
22684 static int __Pyx_modinit_variable_export_code(
void) {
22685 __Pyx_RefNannyDeclarations
22686 __Pyx_RefNannySetupContext(
"__Pyx_modinit_variable_export_code", 0);
22688 __Pyx_RefNannyFinishContext();
22692 static int __Pyx_modinit_function_export_code(
void) {
22693 __Pyx_RefNannyDeclarations
22694 __Pyx_RefNannySetupContext(
"__Pyx_modinit_function_export_code", 0);
22696 __Pyx_RefNannyFinishContext();
22700 static int __Pyx_modinit_type_init_code(
void) {
22701 __Pyx_RefNannyDeclarations
22702 int __pyx_lineno = 0;
22703 const char *__pyx_filename = NULL;
22704 int __pyx_clineno = 0;
22705 __Pyx_RefNannySetupContext(
"__Pyx_modinit_type_init_code", 0);
22707 if (PyType_Ready(&__pyx_type_10csmoothers_cASMFactor) < 0) __PYX_ERR(0, 11, __pyx_L1_error)
22708 #if PY_VERSION_HEX < 0x030800B1
22709 __pyx_type_10csmoothers_cASMFactor.tp_print = 0;
22711 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10csmoothers_cASMFactor.tp_dictoffset && __pyx_type_10csmoothers_cASMFactor.tp_getattro == PyObject_GenericGetAttr)) {
22712 __pyx_type_10csmoothers_cASMFactor.tp_getattro = __Pyx_PyObject_GenericGetAttr;
22714 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_cASMFactor_2, (PyObject *)&__pyx_type_10csmoothers_cASMFactor) < 0) __PYX_ERR(0, 11, __pyx_L1_error)
22715 if (__Pyx_setup_reduce((PyObject*)&__pyx_type_10csmoothers_cASMFactor) < 0) __PYX_ERR(0, 11, __pyx_L1_error)
22716 __pyx_ptype_10csmoothers_cASMFactor = &__pyx_type_10csmoothers_cASMFactor;
22717 if (PyType_Ready(&__pyx_type_10csmoothers_cBASMFactor) < 0) __PYX_ERR(0, 50, __pyx_L1_error)
22718 #if PY_VERSION_HEX < 0x030800B1
22719 __pyx_type_10csmoothers_cBASMFactor.tp_print = 0;
22721 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_10csmoothers_cBASMFactor.tp_dictoffset && __pyx_type_10csmoothers_cBASMFactor.tp_getattro == PyObject_GenericGetAttr)) {
22722 __pyx_type_10csmoothers_cBASMFactor.tp_getattro = __Pyx_PyObject_GenericGetAttr;
22724 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_cBASMFactor_2, (PyObject *)&__pyx_type_10csmoothers_cBASMFactor) < 0) __PYX_ERR(0, 50, __pyx_L1_error)
22725 if (__Pyx_setup_reduce((PyObject*)&__pyx_type_10csmoothers_cBASMFactor) < 0) __PYX_ERR(0, 50, __pyx_L1_error)
22726 __pyx_ptype_10csmoothers_cBASMFactor = &__pyx_type_10csmoothers_cBASMFactor;
22727 __pyx_vtabptr_array = &__pyx_vtable_array;
22728 __pyx_vtable_array.get_memview = (PyObject *(*)(
struct __pyx_array_obj *))__pyx_array_get_memview;
22729 if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(1, 105, __pyx_L1_error)
22730 #if PY_VERSION_HEX < 0x030800B1
22731 __pyx_type___pyx_array.tp_print = 0;
22733 if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(1, 105, __pyx_L1_error)
22734 if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_array) < 0) __PYX_ERR(1, 105, __pyx_L1_error)
22735 __pyx_array_type = &__pyx_type___pyx_array;
22736 if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(1, 279, __pyx_L1_error)
22737 #if PY_VERSION_HEX < 0x030800B1
22738 __pyx_type___pyx_MemviewEnum.tp_print = 0;
22740 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_MemviewEnum.tp_dictoffset && __pyx_type___pyx_MemviewEnum.tp_getattro == PyObject_GenericGetAttr)) {
22741 __pyx_type___pyx_MemviewEnum.tp_getattro = __Pyx_PyObject_GenericGetAttr;
22743 if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(1, 279, __pyx_L1_error)
22744 __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
22745 __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview;
22746 __pyx_vtable_memoryview.get_item_pointer = (
char *(*)(
struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer;
22747 __pyx_vtable_memoryview.is_slice = (PyObject *(*)(
struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice;
22748 __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(
struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment;
22749 __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(
struct __pyx_memoryview_obj *,
struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar;
22750 __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(
struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed;
22751 __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(
struct __pyx_memoryview_obj *,
char *))__pyx_memoryview_convert_item_to_object;
22752 __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(
struct __pyx_memoryview_obj *,
char *, PyObject *))__pyx_memoryview_assign_item_from_object;
22753 if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(1, 330, __pyx_L1_error)
22754 #if PY_VERSION_HEX < 0x030800B1
22755 __pyx_type___pyx_memoryview.tp_print = 0;
22757 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryview.tp_dictoffset && __pyx_type___pyx_memoryview.tp_getattro == PyObject_GenericGetAttr)) {
22758 __pyx_type___pyx_memoryview.tp_getattro = __Pyx_PyObject_GenericGetAttr;
22760 if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(1, 330, __pyx_L1_error)
22761 if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(1, 330, __pyx_L1_error)
22762 __pyx_memoryview_type = &__pyx_type___pyx_memoryview;
22763 __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice;
22764 __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview;
22765 __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(
struct __pyx_memoryview_obj *,
char *))__pyx_memoryviewslice_convert_item_to_object;
22766 __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(
struct __pyx_memoryview_obj *,
char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object;
22767 __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type;
22768 if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(1, 965, __pyx_L1_error)
22769 #if PY_VERSION_HEX < 0x030800B1
22770 __pyx_type___pyx_memoryviewslice.tp_print = 0;
22772 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryviewslice.tp_dictoffset && __pyx_type___pyx_memoryviewslice.tp_getattro == PyObject_GenericGetAttr)) {
22773 __pyx_type___pyx_memoryviewslice.tp_getattro = __Pyx_PyObject_GenericGetAttr;
22775 if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(1, 965, __pyx_L1_error)
22776 if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(1, 965, __pyx_L1_error)
22777 __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice;
22778 __Pyx_RefNannyFinishContext();
22781 __Pyx_RefNannyFinishContext();
22785 static int __Pyx_modinit_type_import_code(
void) {
22786 __Pyx_RefNannyDeclarations
22787 PyObject *__pyx_t_1 = NULL;
22788 int __pyx_lineno = 0;
22789 const char *__pyx_filename = NULL;
22790 int __pyx_clineno = 0;
22791 __Pyx_RefNannySetupContext(
"__Pyx_modinit_type_import_code", 0);
22793 __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME);
if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 9, __pyx_L1_error)
22794 __Pyx_GOTREF(__pyx_t_1);
22795 __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME,
"type",
22796 #
if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
22797 sizeof(PyTypeObject),
22799 sizeof(PyHeapTypeObject),
22801 __Pyx_ImportType_CheckSize_Warn);
22802 if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(3, 9, __pyx_L1_error)
22803 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22804 __pyx_t_1 = PyImport_ImportModule(
"numpy");
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 200, __pyx_L1_error)
22805 __Pyx_GOTREF(__pyx_t_1);
22806 __pyx_ptype_5numpy_dtype = __Pyx_ImportType(__pyx_t_1,
"numpy",
"dtype",
sizeof(PyArray_Descr), __Pyx_ImportType_CheckSize_Ignore);
22807 if (!__pyx_ptype_5numpy_dtype) __PYX_ERR(2, 200, __pyx_L1_error)
22808 __pyx_ptype_5numpy_flatiter = __Pyx_ImportType(__pyx_t_1,
"numpy",
"flatiter",
sizeof(PyArrayIterObject), __Pyx_ImportType_CheckSize_Ignore);
22809 if (!__pyx_ptype_5numpy_flatiter) __PYX_ERR(2, 223, __pyx_L1_error)
22810 __pyx_ptype_5numpy_broadcast = __Pyx_ImportType(__pyx_t_1,
"numpy",
"broadcast",
sizeof(PyArrayMultiIterObject), __Pyx_ImportType_CheckSize_Ignore);
22811 if (!__pyx_ptype_5numpy_broadcast) __PYX_ERR(2, 227, __pyx_L1_error)
22812 __pyx_ptype_5numpy_ndarray = __Pyx_ImportType(__pyx_t_1,
"numpy",
"ndarray",
sizeof(PyArrayObject), __Pyx_ImportType_CheckSize_Ignore);
22813 if (!__pyx_ptype_5numpy_ndarray) __PYX_ERR(2, 239, __pyx_L1_error)
22814 __pyx_ptype_5numpy_generic = __Pyx_ImportType(__pyx_t_1,
"numpy",
"generic",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
22815 if (!__pyx_ptype_5numpy_generic) __PYX_ERR(2, 771, __pyx_L1_error)
22816 __pyx_ptype_5numpy_number = __Pyx_ImportType(__pyx_t_1,
"numpy",
"number",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
22817 if (!__pyx_ptype_5numpy_number) __PYX_ERR(2, 773, __pyx_L1_error)
22818 __pyx_ptype_5numpy_integer = __Pyx_ImportType(__pyx_t_1,
"numpy",
"integer",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
22819 if (!__pyx_ptype_5numpy_integer) __PYX_ERR(2, 775, __pyx_L1_error)
22820 __pyx_ptype_5numpy_signedinteger = __Pyx_ImportType(__pyx_t_1,
"numpy",
"signedinteger",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
22821 if (!__pyx_ptype_5numpy_signedinteger) __PYX_ERR(2, 777, __pyx_L1_error)
22822 __pyx_ptype_5numpy_unsignedinteger = __Pyx_ImportType(__pyx_t_1,
"numpy",
"unsignedinteger",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
22823 if (!__pyx_ptype_5numpy_unsignedinteger) __PYX_ERR(2, 779, __pyx_L1_error)
22824 __pyx_ptype_5numpy_inexact = __Pyx_ImportType(__pyx_t_1,
"numpy",
"inexact",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
22825 if (!__pyx_ptype_5numpy_inexact) __PYX_ERR(2, 781, __pyx_L1_error)
22826 __pyx_ptype_5numpy_floating = __Pyx_ImportType(__pyx_t_1,
"numpy",
"floating",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
22827 if (!__pyx_ptype_5numpy_floating) __PYX_ERR(2, 783, __pyx_L1_error)
22828 __pyx_ptype_5numpy_complexfloating = __Pyx_ImportType(__pyx_t_1,
"numpy",
"complexfloating",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
22829 if (!__pyx_ptype_5numpy_complexfloating) __PYX_ERR(2, 785, __pyx_L1_error)
22830 __pyx_ptype_5numpy_flexible = __Pyx_ImportType(__pyx_t_1,
"numpy",
"flexible",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
22831 if (!__pyx_ptype_5numpy_flexible) __PYX_ERR(2, 787, __pyx_L1_error)
22832 __pyx_ptype_5numpy_character = __Pyx_ImportType(__pyx_t_1,
"numpy",
"character",
sizeof(PyObject), __Pyx_ImportType_CheckSize_Warn);
22833 if (!__pyx_ptype_5numpy_character) __PYX_ERR(2, 789, __pyx_L1_error)
22834 __pyx_ptype_5numpy_ufunc = __Pyx_ImportType(__pyx_t_1,
"numpy",
"ufunc",
sizeof(PyUFuncObject), __Pyx_ImportType_CheckSize_Ignore);
22835 if (!__pyx_ptype_5numpy_ufunc) __PYX_ERR(2, 827, __pyx_L1_error)
22836 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22837 __pyx_t_1 = PyImport_ImportModule(
"proteus.superluWrappers");
if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 67, __pyx_L1_error)
22838 __Pyx_GOTREF(__pyx_t_1);
22839 __pyx_ptype_7proteus_15superluWrappers_cSparseMatrix = __Pyx_ImportType(__pyx_t_1,
"proteus.superluWrappers",
"cSparseMatrix",
sizeof(
struct __pyx_obj_7proteus_15superluWrappers_cSparseMatrix), __Pyx_ImportType_CheckSize_Warn);
22840 if (!__pyx_ptype_7proteus_15superluWrappers_cSparseMatrix) __PYX_ERR(4, 67, __pyx_L1_error)
22841 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22842 __Pyx_RefNannyFinishContext();
22845 __Pyx_XDECREF(__pyx_t_1);
22846 __Pyx_RefNannyFinishContext();
22850 static int __Pyx_modinit_variable_import_code(
void) {
22851 __Pyx_RefNannyDeclarations
22852 __Pyx_RefNannySetupContext(
"__Pyx_modinit_variable_import_code", 0);
22854 __Pyx_RefNannyFinishContext();
22858 static int __Pyx_modinit_function_import_code(
void) {
22859 __Pyx_RefNannyDeclarations
22860 __Pyx_RefNannySetupContext(
"__Pyx_modinit_function_import_code", 0);
22862 __Pyx_RefNannyFinishContext();
22867 #ifndef CYTHON_NO_PYINIT_EXPORT
22868 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
22869 #elif PY_MAJOR_VERSION < 3
22871 #define __Pyx_PyMODINIT_FUNC extern "C" void
22873 #define __Pyx_PyMODINIT_FUNC void
22877 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
22879 #define __Pyx_PyMODINIT_FUNC PyObject *
22884 #if PY_MAJOR_VERSION < 3
22885 __Pyx_PyMODINIT_FUNC initcsmoothers(
void) CYTHON_SMALL_CODE;
22886 __Pyx_PyMODINIT_FUNC initcsmoothers(
void)
22888 __Pyx_PyMODINIT_FUNC PyInit_csmoothers(
void) CYTHON_SMALL_CODE;
22889 __Pyx_PyMODINIT_FUNC PyInit_csmoothers(
void)
22890 #if CYTHON_PEP489_MULTI_PHASE_INIT
22892 return PyModuleDef_Init(&__pyx_moduledef);
22894 static CYTHON_SMALL_CODE
int __Pyx_check_single_interpreter(
void) {
22895 #if PY_VERSION_HEX >= 0x030700A1
22896 static PY_INT64_T main_interpreter_id = -1;
22897 PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
22898 if (main_interpreter_id == -1) {
22899 main_interpreter_id = current_id;
22900 return (unlikely(current_id == -1)) ? -1 : 0;
22901 }
else if (unlikely(main_interpreter_id != current_id))
22903 static PyInterpreterState *main_interpreter = NULL;
22904 PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
22905 if (!main_interpreter) {
22906 main_interpreter = current_interpreter;
22907 }
else if (unlikely(main_interpreter != current_interpreter))
22912 "Interpreter change detected - this module can only be loaded into one interpreter per process.");
22917 static CYTHON_SMALL_CODE
int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict,
const char* from_name,
const char* to_name,
int allow_none) {
22918 PyObject *value = PyObject_GetAttrString(spec, from_name);
22920 if (likely(value)) {
22921 if (allow_none || value != Py_None) {
22922 result = PyDict_SetItemString(moddict, to_name, value);
22925 }
else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
22932 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
22933 PyObject *module = NULL, *moddict, *modname;
22934 if (__Pyx_check_single_interpreter())
22937 return __Pyx_NewRef(__pyx_m);
22938 modname = PyObject_GetAttrString(spec,
"name");
22939 if (unlikely(!modname))
goto bad;
22940 module = PyModule_NewObject(modname);
22941 Py_DECREF(modname);
22942 if (unlikely(!module))
goto bad;
22943 moddict = PyModule_GetDict(module);
22944 if (unlikely(!moddict))
goto bad;
22945 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"loader",
"__loader__", 1) < 0))
goto bad;
22946 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"origin",
"__file__", 1) < 0))
goto bad;
22947 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"parent",
"__package__", 1) < 0))
goto bad;
22948 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"submodule_search_locations",
"__path__", 0) < 0))
goto bad;
22951 Py_XDECREF(module);
22956 static CYTHON_SMALL_CODE
int __pyx_pymod_exec_csmoothers(PyObject *__pyx_pyinit_module)
22960 PyObject *__pyx_t_1 = NULL;
22961 PyObject *__pyx_t_2 = NULL;
22962 PyObject *__pyx_t_3 = NULL;
22963 static PyThread_type_lock __pyx_t_4[8];
22964 int __pyx_lineno = 0;
22965 const char *__pyx_filename = NULL;
22966 int __pyx_clineno = 0;
22967 __Pyx_RefNannyDeclarations
22968 #if CYTHON_PEP489_MULTI_PHASE_INIT
22970 if (__pyx_m == __pyx_pyinit_module)
return 0;
22971 PyErr_SetString(PyExc_RuntimeError,
"Module 'csmoothers' has already been imported. Re-initialisation is not supported.");
22974 #elif PY_MAJOR_VERSION >= 3
22975 if (__pyx_m)
return __Pyx_NewRef(__pyx_m);
22977 #if CYTHON_REFNANNY
22978 __Pyx_RefNanny = __Pyx_RefNannyImportAPI(
"refnanny");
22979 if (!__Pyx_RefNanny) {
22981 __Pyx_RefNanny = __Pyx_RefNannyImportAPI(
"Cython.Runtime.refnanny");
22982 if (!__Pyx_RefNanny)
22983 Py_FatalError(
"failed to import 'refnanny' module");
22986 __Pyx_RefNannySetupContext(
"__Pyx_PyMODINIT_FUNC PyInit_csmoothers(void)", 0);
22987 if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22988 #ifdef __Pxy_PyFrame_Initialize_Offsets
22989 __Pxy_PyFrame_Initialize_Offsets();
22991 __pyx_empty_tuple = PyTuple_New(0);
if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
22992 __pyx_empty_bytes = PyBytes_FromStringAndSize(
"", 0);
if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
22993 __pyx_empty_unicode = PyUnicode_FromStringAndSize(
"", 0);
if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
22994 #ifdef __Pyx_CyFunction_USED
22995 if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
22997 #ifdef __Pyx_FusedFunction_USED
22998 if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23000 #ifdef __Pyx_Coroutine_USED
23001 if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23003 #ifdef __Pyx_Generator_USED
23004 if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23006 #ifdef __Pyx_AsyncGen_USED
23007 if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23009 #ifdef __Pyx_StopAsyncIteration_USED
23010 if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23014 #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
23015 PyEval_InitThreads();
23018 #if CYTHON_PEP489_MULTI_PHASE_INIT
23019 __pyx_m = __pyx_pyinit_module;
23020 Py_INCREF(__pyx_m);
23022 #if PY_MAJOR_VERSION < 3
23023 __pyx_m = Py_InitModule4(
"csmoothers", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
23025 __pyx_m = PyModule_Create(&__pyx_moduledef);
23027 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
23029 __pyx_d = PyModule_GetDict(__pyx_m);
if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
23030 Py_INCREF(__pyx_d);
23031 __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME);
if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
23032 Py_INCREF(__pyx_b);
23033 __pyx_cython_runtime = PyImport_AddModule((
char *)
"cython_runtime");
if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
23034 Py_INCREF(__pyx_cython_runtime);
23035 if (PyObject_SetAttrString(__pyx_m,
"__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
23037 if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23038 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
23039 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23041 if (__pyx_module_is_main_csmoothers) {
23042 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23044 #if PY_MAJOR_VERSION >= 3
23046 PyObject *modules = PyImport_GetModuleDict();
if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
23047 if (!PyDict_GetItemString(modules,
"csmoothers")) {
23048 if (unlikely(PyDict_SetItemString(modules,
"csmoothers", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
23053 if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23055 if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23057 (void)__Pyx_modinit_global_init_code();
23058 (void)__Pyx_modinit_variable_export_code();
23059 (void)__Pyx_modinit_function_export_code();
23060 if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
23061 if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
23062 (void)__Pyx_modinit_variable_import_code();
23063 (void)__Pyx_modinit_function_import_code();
23065 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
23066 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23074 __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
23075 __Pyx_GOTREF(__pyx_t_1);
23076 if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23077 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23086 __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__25);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error)
23087 __Pyx_GOTREF(__pyx_t_1);
23088 __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_tuple__25, __pyx_n_s_ASMFactor, __pyx_n_s_ASMFactor, (PyObject *) NULL, __pyx_n_s_csmoothers, (PyObject *) NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5, __pyx_L1_error)
23089 __Pyx_GOTREF(__pyx_t_2);
23098 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_10csmoothers_9ASMFactor_1__init__, 0, __pyx_n_s_ASMFactor___init, NULL, __pyx_n_s_csmoothers, __pyx_d, ((PyObject *)__pyx_codeobj__27));
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 7, __pyx_L1_error)
23099 __Pyx_GOTREF(__pyx_t_3);
23100 if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init, __pyx_t_3) < 0) __PYX_ERR(0, 7, __pyx_L1_error)
23101 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23110 __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_ASMFactor, __pyx_tuple__25, __pyx_t_2, NULL, 0, 1);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5, __pyx_L1_error)
23111 __Pyx_GOTREF(__pyx_t_3);
23112 if (PyDict_SetItem(__pyx_d, __pyx_n_s_ASMFactor, __pyx_t_3) < 0) __PYX_ERR(0, 5, __pyx_L1_error)
23113 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23114 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
23115 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23124 __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__28);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error)
23125 __Pyx_GOTREF(__pyx_t_1);
23126 __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_tuple__28, __pyx_n_s_BASMFactor, __pyx_n_s_BASMFactor, (PyObject *) NULL, __pyx_n_s_csmoothers, (PyObject *) NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error)
23127 __Pyx_GOTREF(__pyx_t_2);
23136 __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_10csmoothers_10BASMFactor_1__init__, 0, __pyx_n_s_BASMFactor___init, NULL, __pyx_n_s_csmoothers, __pyx_d, ((PyObject *)__pyx_codeobj__30));
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 44, __pyx_L1_error)
23137 __Pyx_GOTREF(__pyx_t_3);
23138 if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init, __pyx_t_3) < 0) __PYX_ERR(0, 44, __pyx_L1_error)
23139 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23148 __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_BASMFactor, __pyx_tuple__28, __pyx_t_2, NULL, 0, 1);
if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 42, __pyx_L1_error)
23149 __Pyx_GOTREF(__pyx_t_3);
23150 if (PyDict_SetItem(__pyx_d, __pyx_n_s_BASMFactor, __pyx_t_3) < 0) __PYX_ERR(0, 42, __pyx_L1_error)
23151 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
23152 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
23153 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23162 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10csmoothers_1jacobi_NR_prepare, NULL, __pyx_n_s_csmoothers);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error)
23163 __Pyx_GOTREF(__pyx_t_1);
23164 if (PyDict_SetItem(__pyx_d, __pyx_n_s_jacobi_NR_prepare, __pyx_t_1) < 0) __PYX_ERR(0, 84, __pyx_L1_error)
23165 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23174 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10csmoothers_3jacobi_NR_solve, NULL, __pyx_n_s_csmoothers);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L1_error)
23175 __Pyx_GOTREF(__pyx_t_1);
23176 if (PyDict_SetItem(__pyx_d, __pyx_n_s_jacobi_NR_solve, __pyx_t_1) < 0) __PYX_ERR(0, 109, __pyx_L1_error)
23177 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23186 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10csmoothers_5nl_jacobi_NR_solve, NULL, __pyx_n_s_csmoothers);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 136, __pyx_L1_error)
23187 __Pyx_GOTREF(__pyx_t_1);
23188 if (PyDict_SetItem(__pyx_d, __pyx_n_s_nl_jacobi_NR_solve, __pyx_t_1) < 0) __PYX_ERR(0, 136, __pyx_L1_error)
23189 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23198 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10csmoothers_7gauss_seidel_NR_preare, NULL, __pyx_n_s_csmoothers);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L1_error)
23199 __Pyx_GOTREF(__pyx_t_1);
23200 if (PyDict_SetItem(__pyx_d, __pyx_n_s_gauss_seidel_NR_preare, __pyx_t_1) < 0) __PYX_ERR(0, 165, __pyx_L1_error)
23201 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23210 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10csmoothers_9gauss_seidel_NR_solve, NULL, __pyx_n_s_csmoothers);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __pyx_L1_error)
23211 __Pyx_GOTREF(__pyx_t_1);
23212 if (PyDict_SetItem(__pyx_d, __pyx_n_s_gauss_seidel_NR_solve, __pyx_t_1) < 0) __PYX_ERR(0, 190, __pyx_L1_error)
23213 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23222 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10csmoothers_11nl_gauss_seidel_NR_solve, NULL, __pyx_n_s_csmoothers);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 217, __pyx_L1_error)
23223 __Pyx_GOTREF(__pyx_t_1);
23224 if (PyDict_SetItem(__pyx_d, __pyx_n_s_nl_gauss_seidel_NR_solve, __pyx_t_1) < 0) __PYX_ERR(0, 217, __pyx_L1_error)
23225 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23234 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10csmoothers_13asm_NR_prepare, NULL, __pyx_n_s_csmoothers);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 251, __pyx_L1_error)
23235 __Pyx_GOTREF(__pyx_t_1);
23236 if (PyDict_SetItem(__pyx_d, __pyx_n_s_asm_NR_prepare, __pyx_t_1) < 0) __PYX_ERR(0, 251, __pyx_L1_error)
23237 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23246 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10csmoothers_15asm_NR_solve, NULL, __pyx_n_s_csmoothers);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 277, __pyx_L1_error)
23247 __Pyx_GOTREF(__pyx_t_1);
23248 if (PyDict_SetItem(__pyx_d, __pyx_n_s_asm_NR_solve, __pyx_t_1) < 0) __PYX_ERR(0, 277, __pyx_L1_error)
23249 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23258 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10csmoothers_17basm_NR_prepare, NULL, __pyx_n_s_csmoothers);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 321, __pyx_L1_error)
23259 __Pyx_GOTREF(__pyx_t_1);
23260 if (PyDict_SetItem(__pyx_d, __pyx_n_s_basm_NR_prepare, __pyx_t_1) < 0) __PYX_ERR(0, 321, __pyx_L1_error)
23261 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23270 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_10csmoothers_19basm_NR_solve, NULL, __pyx_n_s_csmoothers);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 350, __pyx_L1_error)
23271 __Pyx_GOTREF(__pyx_t_1);
23272 if (PyDict_SetItem(__pyx_d, __pyx_n_s_basm_NR_solve, __pyx_t_1) < 0) __PYX_ERR(0, 350, __pyx_L1_error)
23273 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23280 __pyx_t_1 = __Pyx_PyDict_NewPresized(0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
23281 __Pyx_GOTREF(__pyx_t_1);
23282 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
23283 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23292 __pyx_t_1 = __pyx_capsule_create(((
void *)(&__pyx_array_getbuffer)), ((
char *)
"getbuffer(obj, view, flags)"));
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 209, __pyx_L1_error)
23293 __Pyx_GOTREF(__pyx_t_1);
23294 if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(1, 209, __pyx_L1_error)
23295 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23296 PyType_Modified(__pyx_array_type);
23305 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__51, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 286, __pyx_L1_error)
23306 __Pyx_GOTREF(__pyx_t_1);
23307 __Pyx_XGOTREF(
generic);
23308 __Pyx_DECREF_SET(
generic, __pyx_t_1);
23309 __Pyx_GIVEREF(__pyx_t_1);
23319 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__52, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 287, __pyx_L1_error)
23320 __Pyx_GOTREF(__pyx_t_1);
23321 __Pyx_XGOTREF(strided);
23322 __Pyx_DECREF_SET(strided, __pyx_t_1);
23323 __Pyx_GIVEREF(__pyx_t_1);
23333 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__53, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 288, __pyx_L1_error)
23334 __Pyx_GOTREF(__pyx_t_1);
23335 __Pyx_XGOTREF(indirect);
23336 __Pyx_DECREF_SET(indirect, __pyx_t_1);
23337 __Pyx_GIVEREF(__pyx_t_1);
23347 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__54, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 291, __pyx_L1_error)
23348 __Pyx_GOTREF(__pyx_t_1);
23349 __Pyx_XGOTREF(contiguous);
23350 __Pyx_DECREF_SET(contiguous, __pyx_t_1);
23351 __Pyx_GIVEREF(__pyx_t_1);
23361 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__55, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 292, __pyx_L1_error)
23362 __Pyx_GOTREF(__pyx_t_1);
23363 __Pyx_XGOTREF(indirect_contiguous);
23364 __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_1);
23365 __Pyx_GIVEREF(__pyx_t_1);
23375 __pyx_memoryview_thread_locks_used = 0;
23384 __pyx_t_4[0] = PyThread_allocate_lock();
23385 __pyx_t_4[1] = PyThread_allocate_lock();
23386 __pyx_t_4[2] = PyThread_allocate_lock();
23387 __pyx_t_4[3] = PyThread_allocate_lock();
23388 __pyx_t_4[4] = PyThread_allocate_lock();
23389 __pyx_t_4[5] = PyThread_allocate_lock();
23390 __pyx_t_4[6] = PyThread_allocate_lock();
23391 __pyx_t_4[7] = PyThread_allocate_lock();
23392 memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_4,
sizeof(__pyx_memoryview_thread_locks[0]) * (8));
23401 __pyx_t_1 = __pyx_capsule_create(((
void *)(&__pyx_memoryview_getbuffer)), ((
char *)
"getbuffer(obj, view, flags)"));
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 549, __pyx_L1_error)
23402 __Pyx_GOTREF(__pyx_t_1);
23403 if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(1, 549, __pyx_L1_error)
23404 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23405 PyType_Modified(__pyx_memoryview_type);
23414 __pyx_t_1 = __pyx_capsule_create(((
void *)(&__pyx_memoryview_getbuffer)), ((
char *)
"getbuffer(obj, view, flags)"));
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 995, __pyx_L1_error)
23415 __Pyx_GOTREF(__pyx_t_1);
23416 if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(1, 995, __pyx_L1_error)
23417 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23418 PyType_Modified(__pyx_memoryviewslice_type);
23425 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView);
if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
23426 __Pyx_GOTREF(__pyx_t_1);
23427 if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
23428 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
23442 __Pyx_XDECREF(__pyx_t_1);
23443 __Pyx_XDECREF(__pyx_t_2);
23444 __Pyx_XDECREF(__pyx_t_3);
23447 __Pyx_AddTraceback(
"init csmoothers", __pyx_clineno, __pyx_lineno, __pyx_filename);
23450 }
else if (!PyErr_Occurred()) {
23451 PyErr_SetString(PyExc_ImportError,
"init csmoothers");
23454 __Pyx_RefNannyFinishContext();
23455 #if CYTHON_PEP489_MULTI_PHASE_INIT
23456 return (__pyx_m != NULL) ? 0 : -1;
23457 #elif PY_MAJOR_VERSION >= 3
23466 #if CYTHON_REFNANNY
23467 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(
const char *modname) {
23468 PyObject *m = NULL, *p = NULL;
23470 m = PyImport_ImportModule(modname);
23472 p = PyObject_GetAttrString(m,
"RefNannyAPI");
23474 r = PyLong_AsVoidPtr(p);
23478 return (__Pyx_RefNannyAPIStruct *)
r;
23483 #if CYTHON_USE_TYPE_SLOTS
23484 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
23485 PyTypeObject* tp = Py_TYPE(obj);
23486 if (likely(tp->tp_getattro))
23487 return tp->tp_getattro(obj, attr_name);
23488 #if PY_MAJOR_VERSION < 3
23489 if (likely(tp->tp_getattr))
23490 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
23492 return PyObject_GetAttr(obj, attr_name);
23497 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
23498 PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
23499 if (unlikely(!result)) {
23500 PyErr_Format(PyExc_NameError,
23501 #
if PY_MAJOR_VERSION >= 3
23502 "name '%U' is not defined", name);
23504 "name '%.200s' is not defined", PyString_AS_STRING(name));
23511 static void __Pyx_RaiseArgtupleInvalid(
23512 const char* func_name,
23514 Py_ssize_t num_min,
23515 Py_ssize_t num_max,
23516 Py_ssize_t num_found)
23518 Py_ssize_t num_expected;
23519 const char *more_or_less;
23520 if (num_found < num_min) {
23521 num_expected = num_min;
23522 more_or_less =
"at least";
23524 num_expected = num_max;
23525 more_or_less =
"at most";
23528 more_or_less =
"exactly";
23530 PyErr_Format(PyExc_TypeError,
23531 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T
"d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T
"d given)",
23532 func_name, more_or_less, num_expected,
23533 (num_expected == 1) ?
"" :
"s", num_found);
23537 static void __Pyx_RaiseDoubleKeywordsError(
23538 const char* func_name,
23541 PyErr_Format(PyExc_TypeError,
23542 #
if PY_MAJOR_VERSION >= 3
23543 "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
23545 "%s() got multiple values for keyword argument '%s'", func_name,
23546 PyString_AsString(kw_name));
23551 static int __Pyx_ParseOptionalKeywords(
23553 PyObject **argnames[],
23555 PyObject *values[],
23556 Py_ssize_t num_pos_args,
23557 const char* function_name)
23559 PyObject *key = 0, *value = 0;
23560 Py_ssize_t
pos = 0;
23562 PyObject*** first_kw_arg = argnames + num_pos_args;
23563 while (PyDict_Next(kwds, &
pos, &key, &value)) {
23564 name = first_kw_arg;
23565 while (*name && (**name != key)) name++;
23567 values[name-argnames] = value;
23570 name = first_kw_arg;
23571 #if PY_MAJOR_VERSION < 3
23572 if (likely(PyString_Check(key))) {
23574 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
23575 && _PyString_Eq(**name, key)) {
23576 values[name-argnames] = value;
23581 if (*name)
continue;
23583 PyObject*** argname = argnames;
23584 while (argname != first_kw_arg) {
23585 if ((**argname == key) || (
23586 (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
23587 && _PyString_Eq(**argname, key))) {
23588 goto arg_passed_twice;
23595 if (likely(PyUnicode_Check(key))) {
23597 int cmp = (**name == key) ? 0 :
23598 #
if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
23599 (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
23601 PyUnicode_Compare(**name, key);
23602 if (cmp < 0 && unlikely(PyErr_Occurred()))
goto bad;
23604 values[name-argnames] = value;
23609 if (*name)
continue;
23611 PyObject*** argname = argnames;
23612 while (argname != first_kw_arg) {
23613 int cmp = (**argname == key) ? 0 :
23614 #
if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
23615 (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
23617 PyUnicode_Compare(**argname, key);
23618 if (cmp < 0 && unlikely(PyErr_Occurred()))
goto bad;
23619 if (cmp == 0)
goto arg_passed_twice;
23624 goto invalid_keyword_type;
23626 if (unlikely(PyDict_SetItem(kwds2, key, value)))
goto bad;
23628 goto invalid_keyword;
23633 __Pyx_RaiseDoubleKeywordsError(function_name, key);
23635 invalid_keyword_type:
23636 PyErr_Format(PyExc_TypeError,
23637 "%.200s() keywords must be strings", function_name);
23640 PyErr_Format(PyExc_TypeError,
23641 #
if PY_MAJOR_VERSION < 3
23642 "%.200s() got an unexpected keyword argument '%.200s'",
23643 function_name, PyString_AsString(key));
23645 "%s() got an unexpected keyword argument '%U'",
23646 function_name, key);
23653 #if CYTHON_USE_TYPE_SLOTS
23654 static CYTHON_INLINE
int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
23655 PyTypeObject* tp = Py_TYPE(obj);
23656 if (likely(tp->tp_setattro))
23657 return tp->tp_setattro(obj, attr_name, value);
23658 #if PY_MAJOR_VERSION < 3
23659 if (likely(tp->tp_setattr))
23660 return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
23662 return PyObject_SetAttr(obj, attr_name, value);
23667 #if CYTHON_FAST_PYCCALL
23668 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
23669 PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
23670 PyCFunction meth = PyCFunction_GET_FUNCTION(func);
23671 PyObject *
self = PyCFunction_GET_SELF(func);
23672 int flags = PyCFunction_GET_FLAGS(func);
23673 assert(PyCFunction_Check(func));
23674 assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
23675 assert(nargs >= 0);
23676 assert(nargs == 0 || args != NULL);
23680 assert(!PyErr_Occurred());
23681 if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
23682 return (*((__Pyx_PyCFunctionFastWithKeywords)(
void*)meth)) (
self, args, nargs, NULL);
23684 return (*((__Pyx_PyCFunctionFast)(
void*)meth)) (
self, args, nargs);
23690 #if CYTHON_FAST_PYCALL
23691 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
23692 PyObject *globals) {
23694 PyThreadState *tstate = __Pyx_PyThreadState_Current;
23695 PyObject **fastlocals;
23698 assert(globals != NULL);
23703 assert(tstate != NULL);
23704 f = PyFrame_New(tstate, co, globals, NULL);
23708 fastlocals = __Pyx_PyFrame_GetLocalsplus(
f);
23709 for (i = 0; i < na; i++) {
23711 fastlocals[i] = *args++;
23713 result = PyEval_EvalFrameEx(
f,0);
23714 ++tstate->recursion_depth;
23716 --tstate->recursion_depth;
23719 #if 1 || PY_VERSION_HEX < 0x030600B1
23720 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
23721 PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
23722 PyObject *globals = PyFunction_GET_GLOBALS(func);
23723 PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
23725 #if PY_MAJOR_VERSION >= 3
23728 PyObject *kwtuple, **k;
23733 assert(kwargs == NULL || PyDict_Check(kwargs));
23734 nk = kwargs ? PyDict_Size(kwargs) : 0;
23735 if (Py_EnterRecursiveCall((
char*)
" while calling a Python object")) {
23739 #
if PY_MAJOR_VERSION >= 3
23740 co->co_kwonlyargcount == 0 &&
23742 likely(kwargs == NULL || nk == 0) &&
23743 co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
23744 if (argdefs == NULL && co->co_argcount == nargs) {
23745 result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
23748 else if (nargs == 0 && argdefs != NULL
23749 && co->co_argcount == Py_SIZE(argdefs)) {
23752 args = &PyTuple_GET_ITEM(argdefs, 0);
23753 result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
23757 if (kwargs != NULL) {
23759 kwtuple = PyTuple_New(2 * nk);
23760 if (kwtuple == NULL) {
23764 k = &PyTuple_GET_ITEM(kwtuple, 0);
23766 while (PyDict_Next(kwargs, &
pos, &k[i], &k[i+1])) {
23777 closure = PyFunction_GET_CLOSURE(func);
23778 #if PY_MAJOR_VERSION >= 3
23779 kwdefs = PyFunction_GET_KW_DEFAULTS(func);
23781 if (argdefs != NULL) {
23782 d = &PyTuple_GET_ITEM(argdefs, 0);
23783 nd = Py_SIZE(argdefs);
23789 #if PY_MAJOR_VERSION >= 3
23790 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
23793 d, (
int)nd, kwdefs, closure);
23795 result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
23798 d, (
int)nd, closure);
23800 Py_XDECREF(kwtuple);
23802 Py_LeaveRecursiveCall();
23809 #if CYTHON_COMPILING_IN_CPYTHON
23810 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
23812 ternaryfunc call = Py_TYPE(func)->tp_call;
23813 if (unlikely(!call))
23814 return PyObject_Call(func, arg, kw);
23815 if (unlikely(Py_EnterRecursiveCall((
char*)
" while calling a Python object")))
23817 result = (*call)(func, arg, kw);
23818 Py_LeaveRecursiveCall();
23819 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
23822 "NULL result without error in PyObject_Call");
23829 #if CYTHON_COMPILING_IN_CPYTHON
23830 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
23831 PyObject *
self, *result;
23833 cfunc = PyCFunction_GET_FUNCTION(func);
23834 self = PyCFunction_GET_SELF(func);
23835 if (unlikely(Py_EnterRecursiveCall((
char*)
" while calling a Python object")))
23837 result = cfunc(
self, arg);
23838 Py_LeaveRecursiveCall();
23839 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
23842 "NULL result without error in PyObject_Call");
23849 #if CYTHON_COMPILING_IN_CPYTHON
23850 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
23852 PyObject *args = PyTuple_New(1);
23853 if (unlikely(!args))
return NULL;
23855 PyTuple_SET_ITEM(args, 0, arg);
23856 result = __Pyx_PyObject_Call(func, args, NULL);
23860 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
23861 #if CYTHON_FAST_PYCALL
23862 if (PyFunction_Check(func)) {
23863 return __Pyx_PyFunction_FastCall(func, &arg, 1);
23866 if (likely(PyCFunction_Check(func))) {
23867 if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
23868 return __Pyx_PyObject_CallMethO(func, arg);
23869 #if CYTHON_FAST_PYCCALL
23870 }
else if (__Pyx_PyFastCFunction_Check(func)) {
23871 return __Pyx_PyCFunction_FastCall(func, &arg, 1);
23875 return __Pyx__PyObject_CallOneArg(func, arg);
23878 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
23880 PyObject *args = PyTuple_Pack(1, arg);
23881 if (unlikely(!args))
return NULL;
23882 result = __Pyx_PyObject_Call(func, args, NULL);
23889 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type,
const char *name,
int exact)
23891 if (unlikely(!type)) {
23892 PyErr_SetString(PyExc_SystemError,
"Missing type object");
23896 #if PY_MAJOR_VERSION == 2
23897 if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj)))
return 1;
23901 if (likely(__Pyx_TypeCheck(obj, type)))
return 1;
23903 PyErr_Format(PyExc_TypeError,
23904 "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
23905 name, type->tp_name, Py_TYPE(obj)->tp_name);
23910 #if CYTHON_FAST_THREAD_STATE
23911 static CYTHON_INLINE
void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
23912 PyObject *tmp_type, *tmp_value, *tmp_tb;
23913 tmp_type = tstate->curexc_type;
23914 tmp_value = tstate->curexc_value;
23915 tmp_tb = tstate->curexc_traceback;
23916 tstate->curexc_type = type;
23917 tstate->curexc_value = value;
23918 tstate->curexc_traceback = tb;
23919 Py_XDECREF(tmp_type);
23920 Py_XDECREF(tmp_value);
23921 Py_XDECREF(tmp_tb);
23923 static CYTHON_INLINE
void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
23924 *type = tstate->curexc_type;
23925 *value = tstate->curexc_value;
23926 *tb = tstate->curexc_traceback;
23927 tstate->curexc_type = 0;
23928 tstate->curexc_value = 0;
23929 tstate->curexc_traceback = 0;
23934 #if PY_MAJOR_VERSION < 3
23935 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
23936 CYTHON_UNUSED PyObject *cause) {
23937 __Pyx_PyThreadState_declare
23939 if (!value || value == Py_None)
23943 if (!tb || tb == Py_None)
23947 if (!PyTraceBack_Check(tb)) {
23948 PyErr_SetString(PyExc_TypeError,
23949 "raise: arg 3 must be a traceback or None");
23953 if (PyType_Check(type)) {
23954 #if CYTHON_COMPILING_IN_PYPY
23956 Py_INCREF(Py_None);
23960 PyErr_NormalizeException(&type, &value, &tb);
23963 PyErr_SetString(PyExc_TypeError,
23964 "instance exception may not have a separate value");
23968 type = (PyObject*) Py_TYPE(type);
23970 if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
23971 PyErr_SetString(PyExc_TypeError,
23972 "raise: exception class must be a subclass of BaseException");
23976 __Pyx_PyThreadState_assign
23977 __Pyx_ErrRestore(type, value, tb);
23986 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
23987 PyObject* owned_instance = NULL;
23988 if (tb == Py_None) {
23990 }
else if (tb && !PyTraceBack_Check(tb)) {
23991 PyErr_SetString(PyExc_TypeError,
23992 "raise: arg 3 must be a traceback or None");
23995 if (value == Py_None)
23997 if (PyExceptionInstance_Check(type)) {
23999 PyErr_SetString(PyExc_TypeError,
24000 "instance exception may not have a separate value");
24004 type = (PyObject*) Py_TYPE(value);
24005 }
else if (PyExceptionClass_Check(type)) {
24006 PyObject *instance_class = NULL;
24007 if (value && PyExceptionInstance_Check(value)) {
24008 instance_class = (PyObject*) Py_TYPE(value);
24009 if (instance_class != type) {
24010 int is_subclass = PyObject_IsSubclass(instance_class, type);
24011 if (!is_subclass) {
24012 instance_class = NULL;
24013 }
else if (unlikely(is_subclass == -1)) {
24016 type = instance_class;
24020 if (!instance_class) {
24023 args = PyTuple_New(0);
24024 else if (PyTuple_Check(value)) {
24028 args = PyTuple_Pack(1, value);
24031 owned_instance = PyObject_Call(type, args, NULL);
24033 if (!owned_instance)
24035 value = owned_instance;
24036 if (!PyExceptionInstance_Check(value)) {
24037 PyErr_Format(PyExc_TypeError,
24038 "calling %R should have returned an instance of "
24039 "BaseException, not %R",
24040 type, Py_TYPE(value));
24045 PyErr_SetString(PyExc_TypeError,
24046 "raise: exception class must be a subclass of BaseException");
24050 PyObject *fixed_cause;
24051 if (cause == Py_None) {
24052 fixed_cause = NULL;
24053 }
else if (PyExceptionClass_Check(cause)) {
24054 fixed_cause = PyObject_CallObject(cause, NULL);
24055 if (fixed_cause == NULL)
24057 }
else if (PyExceptionInstance_Check(cause)) {
24058 fixed_cause = cause;
24059 Py_INCREF(fixed_cause);
24061 PyErr_SetString(PyExc_TypeError,
24062 "exception causes must derive from "
24066 PyException_SetCause(value, fixed_cause);
24068 PyErr_SetObject(type, value);
24070 #if CYTHON_COMPILING_IN_PYPY
24071 PyObject *tmp_type, *tmp_value, *tmp_tb;
24072 PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
24074 PyErr_Restore(tmp_type, tmp_value, tb);
24075 Py_XDECREF(tmp_tb);
24077 PyThreadState *tstate = __Pyx_PyThreadState_Current;
24078 PyObject* tmp_tb = tstate->curexc_traceback;
24079 if (tb != tmp_tb) {
24081 tstate->curexc_traceback = tb;
24082 Py_XDECREF(tmp_tb);
24087 Py_XDECREF(owned_instance);
24093 static CYTHON_INLINE
int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
24094 if (unlikely(!type)) {
24095 PyErr_SetString(PyExc_SystemError,
"Missing type object");
24098 if (likely(__Pyx_TypeCheck(obj, type)))
24100 PyErr_Format(PyExc_TypeError,
"Cannot convert %.200s to %.200s",
24101 Py_TYPE(obj)->tp_name, type->tp_name);
24107 __Pyx_init_memviewslice(
struct __pyx_memoryview_obj *memview,
24109 __Pyx_memviewslice *memviewslice,
24110 int memview_is_new_reference)
24112 __Pyx_RefNannyDeclarations
24114 Py_buffer *buf = &memview->view;
24115 __Pyx_RefNannySetupContext(
"init_memviewslice", 0);
24116 if (unlikely(memviewslice->memview || memviewslice->data)) {
24117 PyErr_SetString(PyExc_ValueError,
24118 "memviewslice is already initialized!");
24121 if (buf->strides) {
24122 for (i = 0; i < ndim; i++) {
24123 memviewslice->strides[i] = buf->strides[i];
24126 Py_ssize_t stride = buf->itemsize;
24127 for (i = ndim - 1; i >= 0; i--) {
24128 memviewslice->strides[i] = stride;
24129 stride *= buf->shape[i];
24132 for (i = 0; i < ndim; i++) {
24133 memviewslice->shape[i] = buf->shape[i];
24134 if (buf->suboffsets) {
24135 memviewslice->suboffsets[i] = buf->suboffsets[i];
24137 memviewslice->suboffsets[i] = -1;
24140 memviewslice->memview = memview;
24141 memviewslice->data = (
char *)buf->buf;
24142 if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) {
24143 Py_INCREF(memview);
24148 memviewslice->memview = 0;
24149 memviewslice->data = 0;
24152 __Pyx_RefNannyFinishContext();
24155 #ifndef Py_NO_RETURN
24156 #define Py_NO_RETURN
24158 static void __pyx_fatalerror(
const char *fmt, ...) Py_NO_RETURN {
24161 #ifdef HAVE_STDARG_PROTOTYPES
24162 va_start(vargs, fmt);
24166 vsnprintf(msg, 200, fmt, vargs);
24168 Py_FatalError(msg);
24170 static CYTHON_INLINE
int
24171 __pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
24172 PyThread_type_lock lock)
24175 PyThread_acquire_lock(lock, 1);
24176 result = (*acquisition_count)++;
24177 PyThread_release_lock(lock);
24180 static CYTHON_INLINE
int
24181 __pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
24182 PyThread_type_lock lock)
24185 PyThread_acquire_lock(lock, 1);
24186 result = (*acquisition_count)--;
24187 PyThread_release_lock(lock);
24190 static CYTHON_INLINE
void
24191 __Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice,
int have_gil,
int lineno)
24194 struct __pyx_memoryview_obj *memview = memslice->memview;
24195 if (unlikely(!memview || (PyObject *) memview == Py_None))
24197 if (unlikely(__pyx_get_slice_count(memview) < 0))
24198 __pyx_fatalerror(
"Acquisition count is %d (line %d)",
24199 __pyx_get_slice_count(memview), lineno);
24200 first_time = __pyx_add_acquisition_count(memview) == 0;
24201 if (unlikely(first_time)) {
24203 Py_INCREF((PyObject *) memview);
24205 PyGILState_STATE _gilstate = PyGILState_Ensure();
24206 Py_INCREF((PyObject *) memview);
24207 PyGILState_Release(_gilstate);
24211 static CYTHON_INLINE
void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice,
24212 int have_gil,
int lineno) {
24214 struct __pyx_memoryview_obj *memview = memslice->memview;
24215 if (unlikely(!memview || (PyObject *) memview == Py_None)) {
24216 memslice->memview = NULL;
24219 if (unlikely(__pyx_get_slice_count(memview) <= 0))
24220 __pyx_fatalerror(
"Acquisition count is %d (line %d)",
24221 __pyx_get_slice_count(memview), lineno);
24222 last_time = __pyx_sub_acquisition_count(memview) == 1;
24223 memslice->data = NULL;
24224 if (unlikely(last_time)) {
24226 Py_CLEAR(memslice->memview);
24228 PyGILState_STATE _gilstate = PyGILState_Ensure();
24229 Py_CLEAR(memslice->memview);
24230 PyGILState_Release(_gilstate);
24233 memslice->memview = NULL;
24238 static void __Pyx_RaiseBufferIndexError(
int axis) {
24239 PyErr_Format(PyExc_IndexError,
24240 "Out of bounds on buffer access (axis %d)", axis);
24244 static void __Pyx_WriteUnraisable(
const char *name, CYTHON_UNUSED
int clineno,
24245 CYTHON_UNUSED
int lineno, CYTHON_UNUSED
const char *filename,
24246 int full_traceback, CYTHON_UNUSED
int nogil) {
24247 PyObject *old_exc, *old_val, *old_tb;
24249 __Pyx_PyThreadState_declare
24251 PyGILState_STATE state;
24253 state = PyGILState_Ensure();
24255 else state = (PyGILState_STATE)-1;
24258 __Pyx_PyThreadState_assign
24259 __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
24260 if (full_traceback) {
24261 Py_XINCREF(old_exc);
24262 Py_XINCREF(old_val);
24263 Py_XINCREF(old_tb);
24264 __Pyx_ErrRestore(old_exc, old_val, old_tb);
24267 #if PY_MAJOR_VERSION < 3
24268 ctx = PyString_FromString(name);
24270 ctx = PyUnicode_FromString(name);
24272 __Pyx_ErrRestore(old_exc, old_val, old_tb);
24274 PyErr_WriteUnraisable(Py_None);
24276 PyErr_WriteUnraisable(ctx);
24281 PyGILState_Release(state);
24286 #if CYTHON_USE_EXC_INFO_STACK
24287 static _PyErr_StackItem *
24288 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
24290 _PyErr_StackItem *exc_info = tstate->exc_info;
24291 while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
24292 exc_info->previous_item != NULL)
24294 exc_info = exc_info->previous_item;
24301 #if CYTHON_FAST_THREAD_STATE
24302 static CYTHON_INLINE
void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
24303 #if CYTHON_USE_EXC_INFO_STACK
24304 _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
24305 *type = exc_info->exc_type;
24306 *value = exc_info->exc_value;
24307 *tb = exc_info->exc_traceback;
24309 *type = tstate->exc_type;
24310 *value = tstate->exc_value;
24311 *tb = tstate->exc_traceback;
24314 Py_XINCREF(*value);
24317 static CYTHON_INLINE
void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
24318 PyObject *tmp_type, *tmp_value, *tmp_tb;
24319 #if CYTHON_USE_EXC_INFO_STACK
24320 _PyErr_StackItem *exc_info = tstate->exc_info;
24321 tmp_type = exc_info->exc_type;
24322 tmp_value = exc_info->exc_value;
24323 tmp_tb = exc_info->exc_traceback;
24324 exc_info->exc_type = type;
24325 exc_info->exc_value = value;
24326 exc_info->exc_traceback = tb;
24328 tmp_type = tstate->exc_type;
24329 tmp_value = tstate->exc_value;
24330 tmp_tb = tstate->exc_traceback;
24331 tstate->exc_type = type;
24332 tstate->exc_value = value;
24333 tstate->exc_traceback = tb;
24335 Py_XDECREF(tmp_type);
24336 Py_XDECREF(tmp_value);
24337 Py_XDECREF(tmp_tb);
24342 #if CYTHON_FAST_THREAD_STATE
24343 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
24345 n = PyTuple_GET_SIZE(tuple);
24346 #if PY_MAJOR_VERSION >= 3
24347 for (i=0; i<
n; i++) {
24348 if (exc_type == PyTuple_GET_ITEM(tuple, i))
return 1;
24351 for (i=0; i<
n; i++) {
24352 if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i)))
return 1;
24356 static CYTHON_INLINE
int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
24357 PyObject *exc_type = tstate->curexc_type;
24358 if (exc_type == err)
return 1;
24359 if (unlikely(!exc_type))
return 0;
24360 if (unlikely(PyTuple_Check(err)))
24361 return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
24362 return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
24367 #if CYTHON_FAST_THREAD_STATE
24368 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
24370 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
24373 PyObject *local_type, *local_value, *local_tb;
24374 #if CYTHON_FAST_THREAD_STATE
24375 PyObject *tmp_type, *tmp_value, *tmp_tb;
24376 local_type = tstate->curexc_type;
24377 local_value = tstate->curexc_value;
24378 local_tb = tstate->curexc_traceback;
24379 tstate->curexc_type = 0;
24380 tstate->curexc_value = 0;
24381 tstate->curexc_traceback = 0;
24383 PyErr_Fetch(&local_type, &local_value, &local_tb);
24385 PyErr_NormalizeException(&local_type, &local_value, &local_tb);
24386 #if CYTHON_FAST_THREAD_STATE
24387 if (unlikely(tstate->curexc_type))
24389 if (unlikely(PyErr_Occurred()))
24392 #if PY_MAJOR_VERSION >= 3
24394 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
24398 Py_XINCREF(local_tb);
24399 Py_XINCREF(local_type);
24400 Py_XINCREF(local_value);
24401 *type = local_type;
24402 *value = local_value;
24404 #if CYTHON_FAST_THREAD_STATE
24405 #if CYTHON_USE_EXC_INFO_STACK
24407 _PyErr_StackItem *exc_info = tstate->exc_info;
24408 tmp_type = exc_info->exc_type;
24409 tmp_value = exc_info->exc_value;
24410 tmp_tb = exc_info->exc_traceback;
24411 exc_info->exc_type = local_type;
24412 exc_info->exc_value = local_value;
24413 exc_info->exc_traceback = local_tb;
24416 tmp_type = tstate->exc_type;
24417 tmp_value = tstate->exc_value;
24418 tmp_tb = tstate->exc_traceback;
24419 tstate->exc_type = local_type;
24420 tstate->exc_value = local_value;
24421 tstate->exc_traceback = local_tb;
24423 Py_XDECREF(tmp_type);
24424 Py_XDECREF(tmp_value);
24425 Py_XDECREF(tmp_tb);
24427 PyErr_SetExcInfo(local_type, local_value, local_tb);
24434 Py_XDECREF(local_type);
24435 Py_XDECREF(local_value);
24436 Py_XDECREF(local_tb);
24441 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject*
function, PyObject* arg1, PyObject* arg2) {
24442 PyObject *args, *result = NULL;
24443 #if CYTHON_FAST_PYCALL
24444 if (PyFunction_Check(
function)) {
24445 PyObject *args[2] = {arg1, arg2};
24446 return __Pyx_PyFunction_FastCall(
function, args, 2);
24449 #if CYTHON_FAST_PYCCALL
24450 if (__Pyx_PyFastCFunction_Check(
function)) {
24451 PyObject *args[2] = {arg1, arg2};
24452 return __Pyx_PyCFunction_FastCall(
function, args, 2);
24455 args = PyTuple_New(2);
24456 if (unlikely(!args))
goto done;
24458 PyTuple_SET_ITEM(args, 0, arg1);
24460 PyTuple_SET_ITEM(args, 1, arg2);
24461 Py_INCREF(
function);
24462 result = __Pyx_PyObject_Call(
function, args, NULL);
24464 Py_DECREF(
function);
24470 static CYTHON_INLINE
int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2,
int equals) {
24471 #if CYTHON_COMPILING_IN_PYPY
24472 return PyObject_RichCompareBool(s1, s2, equals);
24475 return (equals == Py_EQ);
24476 }
else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
24477 const char *ps1, *ps2;
24478 Py_ssize_t length = PyBytes_GET_SIZE(s1);
24479 if (length != PyBytes_GET_SIZE(s2))
24480 return (equals == Py_NE);
24481 ps1 = PyBytes_AS_STRING(s1);
24482 ps2 = PyBytes_AS_STRING(s2);
24483 if (ps1[0] != ps2[0]) {
24484 return (equals == Py_NE);
24485 }
else if (length == 1) {
24486 return (equals == Py_EQ);
24489 #if CYTHON_USE_UNICODE_INTERNALS
24490 Py_hash_t hash1, hash2;
24491 hash1 = ((PyBytesObject*)s1)->ob_shash;
24492 hash2 = ((PyBytesObject*)s2)->ob_shash;
24493 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
24494 return (equals == Py_NE);
24497 result = memcmp(ps1, ps2, (
size_t)length);
24498 return (equals == Py_EQ) ? (result == 0) : (result != 0);
24500 }
else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
24501 return (equals == Py_NE);
24502 }
else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
24503 return (equals == Py_NE);
24506 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
24509 result = __Pyx_PyObject_IsTrue(py_result);
24510 Py_DECREF(py_result);
24517 static CYTHON_INLINE
int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2,
int equals) {
24518 #if CYTHON_COMPILING_IN_PYPY
24519 return PyObject_RichCompareBool(s1, s2, equals);
24521 #if PY_MAJOR_VERSION < 3
24522 PyObject* owned_ref = NULL;
24524 int s1_is_unicode, s2_is_unicode;
24528 s1_is_unicode = PyUnicode_CheckExact(s1);
24529 s2_is_unicode = PyUnicode_CheckExact(s2);
24530 #if PY_MAJOR_VERSION < 3
24531 if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
24532 owned_ref = PyUnicode_FromObject(s2);
24533 if (unlikely(!owned_ref))
24537 }
else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
24538 owned_ref = PyUnicode_FromObject(s1);
24539 if (unlikely(!owned_ref))
24543 }
else if (((!s2_is_unicode) & (!s1_is_unicode))) {
24544 return __Pyx_PyBytes_Equals(s1, s2, equals);
24547 if (s1_is_unicode & s2_is_unicode) {
24550 void *data1, *data2;
24551 if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
24553 length = __Pyx_PyUnicode_GET_LENGTH(s1);
24554 if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
24557 #if CYTHON_USE_UNICODE_INTERNALS
24559 Py_hash_t hash1, hash2;
24560 #if CYTHON_PEP393_ENABLED
24561 hash1 = ((PyASCIIObject*)s1)->hash;
24562 hash2 = ((PyASCIIObject*)s2)->hash;
24564 hash1 = ((PyUnicodeObject*)s1)->hash;
24565 hash2 = ((PyUnicodeObject*)s2)->hash;
24567 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
24572 kind = __Pyx_PyUnicode_KIND(s1);
24573 if (kind != __Pyx_PyUnicode_KIND(s2)) {
24576 data1 = __Pyx_PyUnicode_DATA(s1);
24577 data2 = __Pyx_PyUnicode_DATA(s2);
24578 if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
24580 }
else if (length == 1) {
24583 int result = memcmp(data1, data2, (
size_t)(length * kind));
24584 #if PY_MAJOR_VERSION < 3
24585 Py_XDECREF(owned_ref);
24587 return (equals == Py_EQ) ? (result == 0) : (result != 0);
24589 }
else if ((s1 == Py_None) & s2_is_unicode) {
24591 }
else if ((s2 == Py_None) & s1_is_unicode) {
24595 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
24596 #if PY_MAJOR_VERSION < 3
24597 Py_XDECREF(owned_ref);
24601 result = __Pyx_PyObject_IsTrue(py_result);
24602 Py_DECREF(py_result);
24606 #if PY_MAJOR_VERSION < 3
24607 Py_XDECREF(owned_ref);
24609 return (equals == Py_EQ);
24611 #if PY_MAJOR_VERSION < 3
24612 Py_XDECREF(owned_ref);
24614 return (equals == Py_NE);
24619 static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) {
24620 Py_ssize_t
q = a / b;
24621 Py_ssize_t
r = a -
q*b;
24622 q -= ((
r != 0) & ((
r ^ b) < 0));
24627 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *
n) {
24628 #if CYTHON_USE_TYPE_SLOTS
24629 #if PY_MAJOR_VERSION >= 3
24630 if (likely(PyUnicode_Check(
n)))
24632 if (likely(PyString_Check(
n)))
24634 return __Pyx_PyObject_GetAttrStr(o,
n);
24636 return PyObject_GetAttr(o,
n);
24640 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
24642 if (!j)
return NULL;
24643 r = PyObject_GetItem(o, j);
24647 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
24648 CYTHON_NCP_UNUSED
int wraparound,
24649 CYTHON_NCP_UNUSED
int boundscheck) {
24650 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
24651 Py_ssize_t wrapped_i = i;
24652 if (wraparound & unlikely(i < 0)) {
24653 wrapped_i += PyList_GET_SIZE(o);
24655 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
24656 PyObject *
r = PyList_GET_ITEM(o, wrapped_i);
24660 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
24662 return PySequence_GetItem(o, i);
24665 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
24666 CYTHON_NCP_UNUSED
int wraparound,
24667 CYTHON_NCP_UNUSED
int boundscheck) {
24668 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
24669 Py_ssize_t wrapped_i = i;
24670 if (wraparound & unlikely(i < 0)) {
24671 wrapped_i += PyTuple_GET_SIZE(o);
24673 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
24674 PyObject *
r = PyTuple_GET_ITEM(o, wrapped_i);
24678 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
24680 return PySequence_GetItem(o, i);
24683 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
int is_list,
24684 CYTHON_NCP_UNUSED
int wraparound,
24685 CYTHON_NCP_UNUSED
int boundscheck) {
24686 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
24687 if (is_list || PyList_CheckExact(o)) {
24688 Py_ssize_t
n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
24689 if ((!boundscheck) || (likely(__Pyx_is_valid_index(
n, PyList_GET_SIZE(o))))) {
24690 PyObject *
r = PyList_GET_ITEM(o,
n);
24695 else if (PyTuple_CheckExact(o)) {
24696 Py_ssize_t
n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
24697 if ((!boundscheck) || likely(__Pyx_is_valid_index(
n, PyTuple_GET_SIZE(o)))) {
24698 PyObject *
r = PyTuple_GET_ITEM(o,
n);
24703 PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
24704 if (likely(m && m->sq_item)) {
24705 if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
24706 Py_ssize_t l = m->sq_length(o);
24707 if (likely(l >= 0)) {
24710 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
24715 return m->sq_item(o, i);
24719 if (is_list || PySequence_Check(o)) {
24720 return PySequence_GetItem(o, i);
24723 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
24727 #if CYTHON_USE_TYPE_SLOTS
24728 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
24730 Py_ssize_t key_value;
24731 PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
24732 if (unlikely(!(m && m->sq_item))) {
24733 PyErr_Format(PyExc_TypeError,
"'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
24736 key_value = __Pyx_PyIndex_AsSsize_t(index);
24737 if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
24738 return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
24740 if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
24742 PyErr_Format(PyExc_IndexError,
"cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
24746 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
24747 PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
24748 if (likely(m && m->mp_subscript)) {
24749 return m->mp_subscript(obj, key);
24751 return __Pyx_PyObject_GetIndex(obj, key);
24756 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
24757 const char* cstring, Py_ssize_t start, Py_ssize_t stop,
24758 const char* encoding,
const char* errors,
24759 PyObject* (*decode_func)(
const char *
s, Py_ssize_t size,
const char *errors)) {
24761 if (unlikely((start < 0) | (stop < 0))) {
24762 size_t slen = strlen(cstring);
24763 if (unlikely(slen > (
size_t) PY_SSIZE_T_MAX)) {
24764 PyErr_SetString(PyExc_OverflowError,
24765 "c-string too long to convert to Python");
24768 length = (Py_ssize_t) slen;
24777 if (unlikely(stop <= start))
24778 return __Pyx_NewRef(__pyx_empty_unicode);
24779 length = stop - start;
24782 return decode_func(cstring, length, errors);
24784 return PyUnicode_Decode(cstring, length, encoding, errors);
24789 static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
24790 __Pyx_PyThreadState_declare
24791 __Pyx_PyThreadState_assign
24792 if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
24794 __Pyx_PyErr_Clear();
24798 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *
n, PyObject *d) {
24799 PyObject *
r = __Pyx_GetAttr(o,
n);
24800 return (likely(
r)) ?
r : __Pyx_GetAttr3Default(d);
24804 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
24805 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
24806 PyObject *dict = Py_TYPE(obj)->tp_dict;
24807 return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
24809 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
24810 PyObject **dictptr = NULL;
24811 Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
24813 #if CYTHON_COMPILING_IN_CPYTHON
24814 dictptr = (likely(offset > 0)) ? (PyObject **) ((
char *)obj + offset) : _PyObject_GetDictPtr(obj);
24816 dictptr = _PyObject_GetDictPtr(obj);
24819 return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
24821 static CYTHON_INLINE
int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
24822 PyObject *dict = Py_TYPE(obj)->tp_dict;
24823 if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
24825 return obj_dict_version == __Pyx_get_object_dict_version(obj);
24830 #if CYTHON_USE_DICT_VERSIONS
24831 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
24833 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
24837 #if !CYTHON_AVOID_BORROWED_REFS
24838 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
24839 result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
24840 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
24841 if (likely(result)) {
24842 return __Pyx_NewRef(result);
24843 }
else if (unlikely(PyErr_Occurred())) {
24847 result = PyDict_GetItem(__pyx_d, name);
24848 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
24849 if (likely(result)) {
24850 return __Pyx_NewRef(result);
24854 result = PyObject_GetItem(__pyx_d, name);
24855 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
24856 if (likely(result)) {
24857 return __Pyx_NewRef(result);
24861 return __Pyx_GetBuiltinName(name);
24865 static CYTHON_INLINE
void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
24866 PyErr_Format(PyExc_ValueError,
24867 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T
"d)", expected);
24871 static CYTHON_INLINE
void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
24872 PyErr_Format(PyExc_ValueError,
24873 "need more than %" CYTHON_FORMAT_SSIZE_T
"d value%.1s to unpack",
24874 index, (index == 1) ?
"" :
"s");
24878 static CYTHON_INLINE
void __Pyx_RaiseNoneNotIterableError(
void) {
24879 PyErr_SetString(PyExc_TypeError,
"'NoneType' object is not iterable");
24883 #if CYTHON_FAST_THREAD_STATE
24884 static CYTHON_INLINE
void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
24885 PyObject *tmp_type, *tmp_value, *tmp_tb;
24886 #if CYTHON_USE_EXC_INFO_STACK
24887 _PyErr_StackItem *exc_info = tstate->exc_info;
24888 tmp_type = exc_info->exc_type;
24889 tmp_value = exc_info->exc_value;
24890 tmp_tb = exc_info->exc_traceback;
24891 exc_info->exc_type = *type;
24892 exc_info->exc_value = *value;
24893 exc_info->exc_traceback = *tb;
24895 tmp_type = tstate->exc_type;
24896 tmp_value = tstate->exc_value;
24897 tmp_tb = tstate->exc_traceback;
24898 tstate->exc_type = *type;
24899 tstate->exc_value = *value;
24900 tstate->exc_traceback = *tb;
24903 *value = tmp_value;
24907 static CYTHON_INLINE
void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
24908 PyObject *tmp_type, *tmp_value, *tmp_tb;
24909 PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
24910 PyErr_SetExcInfo(*type, *value, *tb);
24912 *value = tmp_value;
24918 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list,
int level) {
24919 PyObject *empty_list = 0;
24920 PyObject *module = 0;
24921 PyObject *global_dict = 0;
24922 PyObject *empty_dict = 0;
24924 #if PY_MAJOR_VERSION < 3
24925 PyObject *py_import;
24926 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
24933 empty_list = PyList_New(0);
24938 global_dict = PyModule_GetDict(__pyx_m);
24941 empty_dict = PyDict_New();
24945 #if PY_MAJOR_VERSION >= 3
24947 if ((1) && (strchr(__Pyx_MODULE_NAME,
'.'))) {
24948 module = PyImport_ImportModuleLevelObject(
24949 name, global_dict, empty_dict, list, 1);
24951 if (!PyErr_ExceptionMatches(PyExc_ImportError))
24960 #if PY_MAJOR_VERSION < 3
24961 PyObject *py_level = PyInt_FromLong(level);
24964 module = PyObject_CallFunctionObjArgs(py_import,
24965 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
24966 Py_DECREF(py_level);
24968 module = PyImport_ImportModuleLevelObject(
24969 name, global_dict, empty_dict, list, level);
24974 #if PY_MAJOR_VERSION < 3
24975 Py_XDECREF(py_import);
24977 Py_XDECREF(empty_list);
24978 Py_XDECREF(empty_dict);
24983 #if CYTHON_COMPILING_IN_CPYTHON
24984 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
24990 return b == &PyBaseObject_Type;
24992 static CYTHON_INLINE
int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
24994 if (a == b)
return 1;
24998 n = PyTuple_GET_SIZE(mro);
24999 for (i = 0; i <
n; i++) {
25000 if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
25005 return __Pyx_InBases(a, b);
25007 #if PY_MAJOR_VERSION == 2
25008 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
25009 PyObject *exception, *value, *tb;
25011 __Pyx_PyThreadState_declare
25012 __Pyx_PyThreadState_assign
25013 __Pyx_ErrFetch(&exception, &value, &tb);
25014 res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
25015 if (unlikely(res == -1)) {
25016 PyErr_WriteUnraisable(err);
25020 res = PyObject_IsSubclass(err, exc_type2);
25021 if (unlikely(res == -1)) {
25022 PyErr_WriteUnraisable(err);
25026 __Pyx_ErrRestore(exception, value, tb);
25030 static CYTHON_INLINE
int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
25031 int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
25033 res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
25038 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
25040 assert(PyExceptionClass_Check(exc_type));
25041 n = PyTuple_GET_SIZE(tuple);
25042 #if PY_MAJOR_VERSION >= 3
25043 for (i=0; i<
n; i++) {
25044 if (exc_type == PyTuple_GET_ITEM(tuple, i))
return 1;
25047 for (i=0; i<
n; i++) {
25048 PyObject *t = PyTuple_GET_ITEM(tuple, i);
25049 #if PY_MAJOR_VERSION < 3
25050 if (likely(exc_type == t))
return 1;
25052 if (likely(PyExceptionClass_Check(t))) {
25053 if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t))
return 1;
25059 static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
25060 if (likely(err == exc_type))
return 1;
25061 if (likely(PyExceptionClass_Check(err))) {
25062 if (likely(PyExceptionClass_Check(exc_type))) {
25063 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
25064 }
else if (likely(PyTuple_Check(exc_type))) {
25065 return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
25069 return PyErr_GivenExceptionMatches(err, exc_type);
25071 static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
25072 assert(PyExceptionClass_Check(exc_type1));
25073 assert(PyExceptionClass_Check(exc_type2));
25074 if (likely(err == exc_type1 || err == exc_type2))
return 1;
25075 if (likely(PyExceptionClass_Check(err))) {
25076 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
25078 return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
25083 #if !CYTHON_COMPILING_IN_PYPY
25084 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED
long intval,
int inplace,
int zerodivision_check) {
25086 (void)zerodivision_check;
25087 #if PY_MAJOR_VERSION < 3
25088 if (likely(PyInt_CheckExact(op1))) {
25089 const long b = intval;
25091 long a = PyInt_AS_LONG(op1);
25092 x = (long)((
unsigned long)a + b);
25093 if (likely((x^a) >= 0 || (x^b) >= 0))
25094 return PyInt_FromLong(x);
25095 return PyLong_Type.tp_as_number->nb_add(op1, op2);
25098 #if CYTHON_USE_PYLONG_INTERNALS
25099 if (likely(PyLong_CheckExact(op1))) {
25100 const long b = intval;
25102 #ifdef HAVE_LONG_LONG
25103 const PY_LONG_LONG llb = intval;
25104 PY_LONG_LONG lla, llx;
25106 const digit* digits = ((PyLongObject*)op1)->ob_digit;
25107 const Py_ssize_t size = Py_SIZE(op1);
25108 if (likely(__Pyx_sst_abs(size) <= 1)) {
25109 a = likely(size) ? digits[0] : 0;
25110 if (size == -1) a = -a;
25114 if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
25115 a = -(long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
25117 #ifdef HAVE_LONG_LONG
25118 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
25119 lla = -(PY_LONG_LONG) (((((
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
25123 CYTHON_FALLTHROUGH;
25125 if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
25126 a = (long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
25128 #ifdef HAVE_LONG_LONG
25129 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
25130 lla = (PY_LONG_LONG) (((((
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
25134 CYTHON_FALLTHROUGH;
25136 if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
25137 a = -(long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
25139 #ifdef HAVE_LONG_LONG
25140 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
25141 lla = -(PY_LONG_LONG) (((((((
unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
25145 CYTHON_FALLTHROUGH;
25147 if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
25148 a = (long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
25150 #ifdef HAVE_LONG_LONG
25151 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
25152 lla = (PY_LONG_LONG) (((((((
unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
25156 CYTHON_FALLTHROUGH;
25158 if (8 *
sizeof(
long) - 1 > 4 * PyLong_SHIFT) {
25159 a = -(long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
25161 #ifdef HAVE_LONG_LONG
25162 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
25163 lla = -(PY_LONG_LONG) (((((((((
unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
25167 CYTHON_FALLTHROUGH;
25169 if (8 *
sizeof(
long) - 1 > 4 * PyLong_SHIFT) {
25170 a = (long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
25172 #ifdef HAVE_LONG_LONG
25173 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
25174 lla = (PY_LONG_LONG) (((((((((
unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
25178 CYTHON_FALLTHROUGH;
25179 default:
return PyLong_Type.tp_as_number->nb_add(op1, op2);
25183 return PyLong_FromLong(x);
25184 #ifdef HAVE_LONG_LONG
25187 return PyLong_FromLongLong(llx);
25193 if (PyFloat_CheckExact(op1)) {
25194 const long b = intval;
25195 double a = PyFloat_AS_DOUBLE(op1);
25197 PyFPE_START_PROTECT(
"add",
return NULL)
25198 result = ((double)a) + (double)b;
25199 PyFPE_END_PROTECT(result)
25200 return PyFloat_FromDouble(result);
25202 return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
25207 static CYTHON_INLINE
void __Pyx_RaiseUnboundLocalError(
const char *varname) {
25208 PyErr_Format(PyExc_UnboundLocalError,
"local variable '%s' referenced before assignment", varname);
25212 static CYTHON_INLINE
long __Pyx_div_long(
long a,
long b) {
25215 q -= ((
r != 0) & ((
r ^ b) < 0));
25220 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
25221 PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
25222 if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
25223 PyErr_Format(PyExc_ImportError,
25224 #
if PY_MAJOR_VERSION < 3
25225 "cannot import name %.230s", PyString_AS_STRING(name));
25227 "cannot import name %S", name);
25234 static CYTHON_INLINE
int __Pyx_HasAttr(PyObject *o, PyObject *
n) {
25236 if (unlikely(!__Pyx_PyBaseString_Check(
n))) {
25237 PyErr_SetString(PyExc_TypeError,
25238 "hasattr(): attribute name must be string");
25241 r = __Pyx_GetAttr(o,
n);
25242 if (unlikely(!
r)) {
25252 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
25253 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
25254 PyErr_Format(PyExc_AttributeError,
25255 #
if PY_MAJOR_VERSION >= 3
25256 "'%.50s' object has no attribute '%U'",
25257 tp->tp_name, attr_name);
25259 "'%.50s' object has no attribute '%.400s'",
25260 tp->tp_name, PyString_AS_STRING(attr_name));
25264 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
25266 PyTypeObject *tp = Py_TYPE(obj);
25267 if (unlikely(!PyString_Check(attr_name))) {
25268 return PyObject_GenericGetAttr(obj, attr_name);
25270 assert(!tp->tp_dictoffset);
25271 descr = _PyType_Lookup(tp, attr_name);
25272 if (unlikely(!descr)) {
25273 return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
25276 #if PY_MAJOR_VERSION < 3
25277 if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
25280 descrgetfunc
f = Py_TYPE(descr)->tp_descr_get;
25282 PyObject *res =
f(descr, obj, (PyObject *)tp);
25292 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
25293 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
25294 if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
25295 return PyObject_GenericGetAttr(obj, attr_name);
25297 return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
25302 static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(
void) {
25303 __Pyx_PyThreadState_declare
25304 __Pyx_PyThreadState_assign
25305 if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
25306 __Pyx_PyErr_Clear();
25308 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
25310 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
25311 PyTypeObject* tp = Py_TYPE(obj);
25312 if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
25313 return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
25316 result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
25317 if (unlikely(!result)) {
25318 __Pyx_PyObject_GetAttrStr_ClearAttributeError();
25324 static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
25326 PyObject *name_attr;
25327 name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2);
25328 if (likely(name_attr)) {
25329 ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
25333 if (unlikely(ret < 0)) {
25337 Py_XDECREF(name_attr);
25340 static int __Pyx_setup_reduce(PyObject* type_obj) {
25342 PyObject *object_reduce = NULL;
25343 PyObject *object_reduce_ex = NULL;
25344 PyObject *reduce = NULL;
25345 PyObject *reduce_ex = NULL;
25346 PyObject *reduce_cython = NULL;
25347 PyObject *setstate = NULL;
25348 PyObject *setstate_cython = NULL;
25349 #if CYTHON_USE_PYTYPE_LOOKUP
25350 if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate))
goto __PYX_GOOD;
25352 if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate))
goto __PYX_GOOD;
25354 #if CYTHON_USE_PYTYPE_LOOKUP
25355 object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex);
if (!object_reduce_ex)
goto __PYX_BAD;
25357 object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex);
if (!object_reduce_ex)
goto __PYX_BAD;
25359 reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex);
if (unlikely(!reduce_ex))
goto __PYX_BAD;
25360 if (reduce_ex == object_reduce_ex) {
25361 #if CYTHON_USE_PYTYPE_LOOKUP
25362 object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce);
if (!object_reduce)
goto __PYX_BAD;
25364 object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce);
if (!object_reduce)
goto __PYX_BAD;
25366 reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce);
if (unlikely(!reduce))
goto __PYX_BAD;
25367 if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
25368 reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
25369 if (likely(reduce_cython)) {
25370 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython);
if (unlikely(ret < 0))
goto __PYX_BAD;
25371 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython);
if (unlikely(ret < 0))
goto __PYX_BAD;
25372 }
else if (reduce == object_reduce || PyErr_Occurred()) {
25375 setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
25376 if (!setstate) PyErr_Clear();
25377 if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
25378 setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
25379 if (likely(setstate_cython)) {
25380 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython);
if (unlikely(ret < 0))
goto __PYX_BAD;
25381 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython);
if (unlikely(ret < 0))
goto __PYX_BAD;
25382 }
else if (!setstate || PyErr_Occurred()) {
25386 PyType_Modified((PyTypeObject*)type_obj);
25391 if (!PyErr_Occurred())
25392 PyErr_Format(PyExc_RuntimeError,
"Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
25395 #if !CYTHON_USE_PYTYPE_LOOKUP
25396 Py_XDECREF(object_reduce);
25397 Py_XDECREF(object_reduce_ex);
25399 Py_XDECREF(reduce);
25400 Py_XDECREF(reduce_ex);
25401 Py_XDECREF(reduce_cython);
25402 Py_XDECREF(setstate);
25403 Py_XDECREF(setstate_cython);
25408 static int __Pyx_SetVtable(PyObject *dict,
void *vtable) {
25409 #if PY_VERSION_HEX >= 0x02070000
25410 PyObject *ob = PyCapsule_New(vtable, 0, 0);
25412 PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
25416 if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
25426 #ifndef __PYX_HAVE_RT_ImportType
25427 #define __PYX_HAVE_RT_ImportType
25428 static PyTypeObject *__Pyx_ImportType(PyObject *module,
const char *module_name,
const char *class_name,
25429 size_t size,
enum __Pyx_ImportType_CheckSize check_size)
25431 PyObject *result = 0;
25433 Py_ssize_t basicsize;
25434 #ifdef Py_LIMITED_API
25435 PyObject *py_basicsize;
25437 result = PyObject_GetAttrString(module, class_name);
25440 if (!PyType_Check(result)) {
25441 PyErr_Format(PyExc_TypeError,
25442 "%.200s.%.200s is not a type object",
25443 module_name, class_name);
25446 #ifndef Py_LIMITED_API
25447 basicsize = ((PyTypeObject *)result)->tp_basicsize;
25449 py_basicsize = PyObject_GetAttrString(result,
"__basicsize__");
25452 basicsize = PyLong_AsSsize_t(py_basicsize);
25453 Py_DECREF(py_basicsize);
25455 if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
25458 if ((
size_t)basicsize < size) {
25459 PyErr_Format(PyExc_ValueError,
25460 "%.200s.%.200s size changed, may indicate binary incompatibility. "
25461 "Expected %zd from C header, got %zd from PyObject",
25462 module_name, class_name, size, basicsize);
25465 if (check_size == __Pyx_ImportType_CheckSize_Error && (
size_t)basicsize != size) {
25466 PyErr_Format(PyExc_ValueError,
25467 "%.200s.%.200s size changed, may indicate binary incompatibility. "
25468 "Expected %zd from C header, got %zd from PyObject",
25469 module_name, class_name, size, basicsize);
25472 else if (check_size == __Pyx_ImportType_CheckSize_Warn && (
size_t)basicsize > size) {
25473 PyOS_snprintf(warning,
sizeof(warning),
25474 "%s.%s size changed, may indicate binary incompatibility. "
25475 "Expected %zd from C header, got %zd from PyObject",
25476 module_name, class_name, size, basicsize);
25477 if (PyErr_WarnEx(NULL, warning, 0) < 0)
goto bad;
25479 return (PyTypeObject *)result;
25481 Py_XDECREF(result);
25487 static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
25488 Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
25489 for (i=0; i < nbases; i++) {
25490 PyTypeObject *tmptype;
25491 PyObject *tmp = PyTuple_GET_ITEM(bases, i);
25492 tmptype = Py_TYPE(tmp);
25493 #if PY_MAJOR_VERSION < 3
25494 if (tmptype == &PyClass_Type)
25498 metaclass = tmptype;
25501 if (PyType_IsSubtype(metaclass, tmptype))
25503 if (PyType_IsSubtype(tmptype, metaclass)) {
25504 metaclass = tmptype;
25507 PyErr_SetString(PyExc_TypeError,
25508 "metaclass conflict: "
25509 "the metaclass of a derived class "
25510 "must be a (non-strict) subclass "
25511 "of the metaclasses of all its bases");
25515 #if PY_MAJOR_VERSION < 3
25516 metaclass = &PyClass_Type;
25518 metaclass = &PyType_Type;
25521 Py_INCREF((PyObject*) metaclass);
25522 return (PyObject*) metaclass;
25526 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
25527 PyObject* fake_module;
25528 PyTypeObject* cached_type = NULL;
25529 fake_module = PyImport_AddModule((
char*)
"_cython_" CYTHON_ABI);
25530 if (!fake_module)
return NULL;
25531 Py_INCREF(fake_module);
25532 cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
25534 if (!PyType_Check((PyObject*)cached_type)) {
25535 PyErr_Format(PyExc_TypeError,
25536 "Shared Cython type %.200s is not a type object",
25540 if (cached_type->tp_basicsize != type->tp_basicsize) {
25541 PyErr_Format(PyExc_TypeError,
25542 "Shared Cython type %.200s has the wrong size, try recompiling",
25547 if (!PyErr_ExceptionMatches(PyExc_AttributeError))
goto bad;
25549 if (PyType_Ready(type) < 0)
goto bad;
25550 if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
25553 cached_type = type;
25556 Py_DECREF(fake_module);
25557 return cached_type;
25559 Py_XDECREF(cached_type);
25560 cached_type = NULL;
25565 #include <structmember.h>
25567 __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *closure)
25569 if (unlikely(op->func_doc == NULL)) {
25570 if (op->func.m_ml->ml_doc) {
25571 #if PY_MAJOR_VERSION >= 3
25572 op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
25574 op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
25576 if (unlikely(op->func_doc == NULL))
25579 Py_INCREF(Py_None);
25583 Py_INCREF(op->func_doc);
25584 return op->func_doc;
25587 __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED
void *context)
25589 PyObject *tmp = op->func_doc;
25590 if (value == NULL) {
25594 op->func_doc = value;
25599 __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
25601 if (unlikely(op->func_name == NULL)) {
25602 #if PY_MAJOR_VERSION >= 3
25603 op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
25605 op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
25607 if (unlikely(op->func_name == NULL))
25610 Py_INCREF(op->func_name);
25611 return op->func_name;
25614 __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED
void *context)
25617 #if PY_MAJOR_VERSION >= 3
25618 if (unlikely(value == NULL || !PyUnicode_Check(value)))
25620 if (unlikely(value == NULL || !PyString_Check(value)))
25623 PyErr_SetString(PyExc_TypeError,
25624 "__name__ must be set to a string object");
25627 tmp = op->func_name;
25629 op->func_name = value;
25634 __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
25636 Py_INCREF(op->func_qualname);
25637 return op->func_qualname;
25640 __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED
void *context)
25643 #if PY_MAJOR_VERSION >= 3
25644 if (unlikely(value == NULL || !PyUnicode_Check(value)))
25646 if (unlikely(value == NULL || !PyString_Check(value)))
25649 PyErr_SetString(PyExc_TypeError,
25650 "__qualname__ must be set to a string object");
25653 tmp = op->func_qualname;
25655 op->func_qualname = value;
25660 __Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED
void *closure)
25663 self = m->func_closure;
25670 __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
25672 if (unlikely(op->func_dict == NULL)) {
25673 op->func_dict = PyDict_New();
25674 if (unlikely(op->func_dict == NULL))
25677 Py_INCREF(op->func_dict);
25678 return op->func_dict;
25681 __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED
void *context)
25684 if (unlikely(value == NULL)) {
25685 PyErr_SetString(PyExc_TypeError,
25686 "function's dictionary may not be deleted");
25689 if (unlikely(!PyDict_Check(value))) {
25690 PyErr_SetString(PyExc_TypeError,
25691 "setting function's dictionary to a non-dict");
25694 tmp = op->func_dict;
25696 op->func_dict = value;
25701 __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
25703 Py_INCREF(op->func_globals);
25704 return op->func_globals;
25707 __Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
25709 Py_INCREF(Py_None);
25713 __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
25715 PyObject* result = (op->func_code) ? op->func_code : Py_None;
25720 __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
25722 PyObject *res = op->defaults_getter((PyObject *) op);
25723 if (unlikely(!res))
25725 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
25726 op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
25727 Py_INCREF(op->defaults_tuple);
25728 op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
25729 Py_INCREF(op->defaults_kwdict);
25731 op->defaults_tuple = PySequence_ITEM(res, 0);
25732 if (unlikely(!op->defaults_tuple)) result = -1;
25734 op->defaults_kwdict = PySequence_ITEM(res, 1);
25735 if (unlikely(!op->defaults_kwdict)) result = -1;
25742 __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED
void *context) {
25746 }
else if (value != Py_None && !PyTuple_Check(value)) {
25747 PyErr_SetString(PyExc_TypeError,
25748 "__defaults__ must be set to a tuple object");
25752 tmp = op->defaults_tuple;
25753 op->defaults_tuple = value;
25758 __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context) {
25759 PyObject* result = op->defaults_tuple;
25760 if (unlikely(!result)) {
25761 if (op->defaults_getter) {
25762 if (__Pyx_CyFunction_init_defaults(op) < 0)
return NULL;
25763 result = op->defaults_tuple;
25772 __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED
void *context) {
25776 }
else if (value != Py_None && !PyDict_Check(value)) {
25777 PyErr_SetString(PyExc_TypeError,
25778 "__kwdefaults__ must be set to a dict object");
25782 tmp = op->defaults_kwdict;
25783 op->defaults_kwdict = value;
25788 __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context) {
25789 PyObject* result = op->defaults_kwdict;
25790 if (unlikely(!result)) {
25791 if (op->defaults_getter) {
25792 if (__Pyx_CyFunction_init_defaults(op) < 0)
return NULL;
25793 result = op->defaults_kwdict;
25802 __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED
void *context) {
25804 if (!value || value == Py_None) {
25806 }
else if (!PyDict_Check(value)) {
25807 PyErr_SetString(PyExc_TypeError,
25808 "__annotations__ must be set to a dict object");
25812 tmp = op->func_annotations;
25813 op->func_annotations = value;
25818 __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context) {
25819 PyObject* result = op->func_annotations;
25820 if (unlikely(!result)) {
25821 result = PyDict_New();
25822 if (unlikely(!result))
return NULL;
25823 op->func_annotations = result;
25828 static PyGetSetDef __pyx_CyFunction_getsets[] = {
25829 {(
char *)
"func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
25830 {(
char *)
"__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
25831 {(
char *)
"func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
25832 {(
char *)
"__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
25833 {(
char *)
"__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
25834 {(
char *)
"__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
25835 {(
char *)
"func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
25836 {(
char *)
"__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
25837 {(
char *)
"func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
25838 {(
char *)
"__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
25839 {(
char *)
"func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
25840 {(
char *)
"__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
25841 {(
char *)
"func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
25842 {(
char *)
"__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
25843 {(
char *)
"func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
25844 {(
char *)
"__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
25845 {(
char *)
"__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
25846 {(
char *)
"__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
25849 static PyMemberDef __pyx_CyFunction_members[] = {
25850 {(
char *)
"__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0},
25854 __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
25856 #if PY_MAJOR_VERSION >= 3
25857 Py_INCREF(m->func_qualname);
25858 return m->func_qualname;
25860 return PyString_FromString(m->func.m_ml->ml_name);
25863 static PyMethodDef __pyx_CyFunction_methods[] = {
25864 {
"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
25867 #if PY_VERSION_HEX < 0x030500A0
25868 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
25870 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
25872 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml,
int flags, PyObject* qualname,
25873 PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
25874 if (unlikely(op == NULL))
25877 __Pyx_CyFunction_weakreflist(op) = NULL;
25878 op->func.m_ml = ml;
25879 op->func.m_self = (PyObject *) op;
25880 Py_XINCREF(closure);
25881 op->func_closure = closure;
25882 Py_XINCREF(module);
25883 op->func.m_module = module;
25884 op->func_dict = NULL;
25885 op->func_name = NULL;
25886 Py_INCREF(qualname);
25887 op->func_qualname = qualname;
25888 op->func_doc = NULL;
25889 op->func_classobj = NULL;
25890 op->func_globals = globals;
25891 Py_INCREF(op->func_globals);
25893 op->func_code = code;
25894 op->defaults_pyobjects = 0;
25895 op->defaults_size = 0;
25896 op->defaults = NULL;
25897 op->defaults_tuple = NULL;
25898 op->defaults_kwdict = NULL;
25899 op->defaults_getter = NULL;
25900 op->func_annotations = NULL;
25901 return (PyObject *) op;
25904 __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
25906 Py_CLEAR(m->func_closure);
25907 Py_CLEAR(m->func.m_module);
25908 Py_CLEAR(m->func_dict);
25909 Py_CLEAR(m->func_name);
25910 Py_CLEAR(m->func_qualname);
25911 Py_CLEAR(m->func_doc);
25912 Py_CLEAR(m->func_globals);
25913 Py_CLEAR(m->func_code);
25914 Py_CLEAR(m->func_classobj);
25915 Py_CLEAR(m->defaults_tuple);
25916 Py_CLEAR(m->defaults_kwdict);
25917 Py_CLEAR(m->func_annotations);
25919 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
25921 for (i = 0; i < m->defaults_pyobjects; i++)
25922 Py_XDECREF(pydefaults[i]);
25923 PyObject_Free(m->defaults);
25924 m->defaults = NULL;
25928 static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
25930 if (__Pyx_CyFunction_weakreflist(m) != NULL)
25931 PyObject_ClearWeakRefs((PyObject *) m);
25932 __Pyx_CyFunction_clear(m);
25933 PyObject_GC_Del(m);
25935 static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
25937 PyObject_GC_UnTrack(m);
25938 __Pyx__CyFunction_dealloc(m);
25940 static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit,
void *arg)
25942 Py_VISIT(m->func_closure);
25943 Py_VISIT(m->func.m_module);
25944 Py_VISIT(m->func_dict);
25945 Py_VISIT(m->func_name);
25946 Py_VISIT(m->func_qualname);
25947 Py_VISIT(m->func_doc);
25948 Py_VISIT(m->func_globals);
25949 Py_VISIT(m->func_code);
25950 Py_VISIT(m->func_classobj);
25951 Py_VISIT(m->defaults_tuple);
25952 Py_VISIT(m->defaults_kwdict);
25954 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
25956 for (i = 0; i < m->defaults_pyobjects; i++)
25957 Py_VISIT(pydefaults[i]);
25961 static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
25963 #if PY_MAJOR_VERSION < 3
25964 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
25965 if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
25969 if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
25971 type = (PyObject *)(Py_TYPE(obj));
25972 return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
25974 if (obj == Py_None)
25977 return __Pyx_PyMethod_New(func, obj, type);
25980 __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
25982 #if PY_MAJOR_VERSION >= 3
25983 return PyUnicode_FromFormat(
"<cyfunction %U at %p>",
25984 op->func_qualname, (
void *)op);
25986 return PyString_FromFormat(
"<cyfunction %s at %p>",
25987 PyString_AsString(op->func_qualname), (
void *)op);
25990 static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *
self, PyObject *arg, PyObject *kw) {
25991 PyCFunctionObject*
f = (PyCFunctionObject*)func;
25992 PyCFunction meth =
f->m_ml->ml_meth;
25994 switch (
f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
25996 if (likely(kw == NULL || PyDict_Size(kw) == 0))
25997 return (*meth)(
self, arg);
25999 case METH_VARARGS | METH_KEYWORDS:
26000 return (*(PyCFunctionWithKeywords)(
void*)meth)(
self, arg, kw);
26002 if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
26003 size = PyTuple_GET_SIZE(arg);
26004 if (likely(size == 0))
26005 return (*meth)(
self, NULL);
26006 PyErr_Format(PyExc_TypeError,
26007 "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T
"d given)",
26008 f->m_ml->ml_name, size);
26013 if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
26014 size = PyTuple_GET_SIZE(arg);
26015 if (likely(size == 1)) {
26016 PyObject *result, *arg0;
26017 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
26018 arg0 = PyTuple_GET_ITEM(arg, 0);
26020 arg0 = PySequence_ITEM(arg, 0);
if (unlikely(!arg0))
return NULL;
26022 result = (*meth)(
self, arg0);
26023 #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
26028 PyErr_Format(PyExc_TypeError,
26029 "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T
"d given)",
26030 f->m_ml->ml_name, size);
26035 PyErr_SetString(PyExc_SystemError,
"Bad call flags in "
26036 "__Pyx_CyFunction_Call. METH_OLDARGS is no "
26037 "longer supported!");
26040 PyErr_Format(PyExc_TypeError,
"%.200s() takes no keyword arguments",
26044 static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
26045 return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
26047 static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
26049 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
26050 if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
26052 PyObject *new_args;
26054 argc = PyTuple_GET_SIZE(args);
26055 new_args = PyTuple_GetSlice(args, 1, argc);
26056 if (unlikely(!new_args))
26058 self = PyTuple_GetItem(args, 0);
26059 if (unlikely(!
self)) {
26060 Py_DECREF(new_args);
26063 result = __Pyx_CyFunction_CallMethod(func,
self, new_args, kw);
26064 Py_DECREF(new_args);
26066 result = __Pyx_CyFunction_Call(func, args, kw);
26070 static PyTypeObject __pyx_CyFunctionType_type = {
26071 PyVarObject_HEAD_INIT(0, 0)
26072 "cython_function_or_method",
26073 sizeof(__pyx_CyFunctionObject),
26075 (destructor) __Pyx_CyFunction_dealloc,
26079 #if PY_MAJOR_VERSION < 3
26084 (reprfunc) __Pyx_CyFunction_repr,
26089 __Pyx_CyFunction_CallAsMethod,
26094 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
26096 (traverseproc) __Pyx_CyFunction_traverse,
26097 (inquiry) __Pyx_CyFunction_clear,
26099 #
if PY_VERSION_HEX < 0x030500A0
26100 offsetof(__pyx_CyFunctionObject, func_weakreflist),
26102 offsetof(PyCFunctionObject, m_weakreflist),
26106 __pyx_CyFunction_methods,
26107 __pyx_CyFunction_members,
26108 __pyx_CyFunction_getsets,
26111 __Pyx_CyFunction_descr_get,
26113 offsetof(__pyx_CyFunctionObject, func_dict),
26126 #if PY_VERSION_HEX >= 0x030400a1
26129 #if PY_VERSION_HEX >= 0x030800b1
26132 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
26136 static int __pyx_CyFunction_init(
void) {
26137 __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
26138 if (unlikely(__pyx_CyFunctionType == NULL)) {
26143 static CYTHON_INLINE
void *__Pyx_CyFunction_InitDefaults(PyObject *func,
size_t size,
int pyobjects) {
26144 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
26145 m->defaults = PyObject_Malloc(size);
26146 if (unlikely(!m->defaults))
26147 return PyErr_NoMemory();
26148 memset(m->defaults, 0, size);
26149 m->defaults_pyobjects = pyobjects;
26150 m->defaults_size = size;
26151 return m->defaults;
26153 static CYTHON_INLINE
void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
26154 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
26155 m->defaults_tuple = tuple;
26158 static CYTHON_INLINE
void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
26159 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
26160 m->defaults_kwdict = dict;
26163 static CYTHON_INLINE
void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
26164 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
26165 m->func_annotations = dict;
26170 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
int flags, PyObject* qualname,
26171 PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
26172 PyObject *op = __Pyx_CyFunction_Init(
26173 PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType),
26174 ml, flags, qualname, closure, module, globals, code
26177 PyObject_GC_Track(op);
26183 static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
26184 PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
26187 PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
26189 PyObject *pargs = PyTuple_Pack(2, name, bases);
26190 if (unlikely(!pargs)) {
26194 ns = PyObject_Call(prep, pargs, mkw);
26198 if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
26208 if (unlikely(PyObject_SetItem(
ns, __pyx_n_s_module, modname) < 0))
goto bad;
26209 if (unlikely(PyObject_SetItem(
ns, __pyx_n_s_qualname, qualname) < 0))
goto bad;
26210 if (unlikely(doc && PyObject_SetItem(
ns, __pyx_n_s_doc, doc) < 0))
goto bad;
26216 static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
26217 PyObject *dict, PyObject *mkw,
26218 int calculate_metaclass,
int allow_py2_metaclass) {
26219 PyObject *result, *margs;
26220 PyObject *owned_metaclass = NULL;
26221 if (allow_py2_metaclass) {
26222 owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
26223 if (owned_metaclass) {
26224 metaclass = owned_metaclass;
26225 }
else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
26231 if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
26232 metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
26233 Py_XDECREF(owned_metaclass);
26234 if (unlikely(!metaclass))
26236 owned_metaclass = metaclass;
26238 margs = PyTuple_Pack(3, name, bases, dict);
26239 if (unlikely(!margs)) {
26242 result = PyObject_Call(metaclass, margs, mkw);
26245 Py_XDECREF(owned_metaclass);
26250 #ifndef CYTHON_CLINE_IN_TRACEBACK
26251 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate,
int c_line) {
26252 PyObject *use_cline;
26253 PyObject *ptype, *pvalue, *ptraceback;
26254 #if CYTHON_COMPILING_IN_CPYTHON
26255 PyObject **cython_runtime_dict;
26257 if (unlikely(!__pyx_cython_runtime)) {
26260 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
26261 #if CYTHON_COMPILING_IN_CPYTHON
26262 cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
26263 if (likely(cython_runtime_dict)) {
26264 __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
26265 use_cline, *cython_runtime_dict,
26266 __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
26270 PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
26271 if (use_cline_obj) {
26272 use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
26273 Py_DECREF(use_cline_obj);
26281 PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
26283 else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
26286 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
26292 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries,
int count,
int code_line) {
26293 int start = 0, mid = 0, end = count - 1;
26294 if (end >= 0 && code_line > entries[end].code_line) {
26297 while (start < end) {
26298 mid = start + (end - start) / 2;
26299 if (code_line < entries[mid].code_line) {
26301 }
else if (code_line > entries[mid].code_line) {
26307 if (code_line <= entries[mid].code_line) {
26313 static PyCodeObject *__pyx_find_code_object(
int code_line) {
26314 PyCodeObject* code_object;
26316 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
26319 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
26320 if (unlikely(
pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[
pos].code_line != code_line)) {
26323 code_object = __pyx_code_cache.entries[
pos].code_object;
26324 Py_INCREF(code_object);
26325 return code_object;
26327 static void __pyx_insert_code_object(
int code_line, PyCodeObject* code_object) {
26329 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
26330 if (unlikely(!code_line)) {
26333 if (unlikely(!entries)) {
26334 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*
sizeof(__Pyx_CodeObjectCacheEntry));
26335 if (likely(entries)) {
26336 __pyx_code_cache.entries = entries;
26337 __pyx_code_cache.max_count = 64;
26338 __pyx_code_cache.count = 1;
26339 entries[0].code_line = code_line;
26340 entries[0].code_object = code_object;
26341 Py_INCREF(code_object);
26345 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
26346 if ((
pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[
pos].code_line == code_line)) {
26347 PyCodeObject* tmp = entries[
pos].code_object;
26348 entries[
pos].code_object = code_object;
26352 if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
26353 int new_max = __pyx_code_cache.max_count + 64;
26354 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
26355 __pyx_code_cache.entries, ((
size_t)new_max) *
sizeof(__Pyx_CodeObjectCacheEntry));
26356 if (unlikely(!entries)) {
26359 __pyx_code_cache.entries = entries;
26360 __pyx_code_cache.max_count = new_max;
26362 for (i=__pyx_code_cache.count; i>
pos; i--) {
26363 entries[i] = entries[i-1];
26365 entries[
pos].code_line = code_line;
26366 entries[
pos].code_object = code_object;
26367 __pyx_code_cache.count++;
26368 Py_INCREF(code_object);
26372 #include "compile.h"
26373 #include "frameobject.h"
26374 #include "traceback.h"
26375 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
26376 const char *funcname,
int c_line,
26377 int py_line,
const char *filename) {
26378 PyCodeObject *py_code = 0;
26379 PyObject *py_srcfile = 0;
26380 PyObject *py_funcname = 0;
26381 #if PY_MAJOR_VERSION < 3
26382 py_srcfile = PyString_FromString(filename);
26384 py_srcfile = PyUnicode_FromString(filename);
26386 if (!py_srcfile)
goto bad;
26388 #if PY_MAJOR_VERSION < 3
26389 py_funcname = PyString_FromFormat(
"%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
26391 py_funcname = PyUnicode_FromFormat(
"%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
26395 #if PY_MAJOR_VERSION < 3
26396 py_funcname = PyString_FromString(funcname);
26398 py_funcname = PyUnicode_FromString(funcname);
26401 if (!py_funcname)
goto bad;
26402 py_code = __Pyx_PyCode_New(
26419 Py_DECREF(py_srcfile);
26420 Py_DECREF(py_funcname);
26423 Py_XDECREF(py_srcfile);
26424 Py_XDECREF(py_funcname);
26427 static void __Pyx_AddTraceback(
const char *funcname,
int c_line,
26428 int py_line,
const char *filename) {
26429 PyCodeObject *py_code = 0;
26430 PyFrameObject *py_frame = 0;
26431 PyThreadState *tstate = __Pyx_PyThreadState_Current;
26433 c_line = __Pyx_CLineForTraceback(tstate, c_line);
26435 py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
26437 py_code = __Pyx_CreateCodeObjectForTraceback(
26438 funcname, c_line, py_line, filename);
26439 if (!py_code)
goto bad;
26440 __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
26442 py_frame = PyFrame_New(
26448 if (!py_frame)
goto bad;
26449 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
26450 PyTraceBack_Here(py_frame);
26452 Py_XDECREF(py_code);
26453 Py_XDECREF(py_frame);
26456 #if PY_MAJOR_VERSION < 3
26457 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view,
int flags) {
26458 if (PyObject_CheckBuffer(obj))
return PyObject_GetBuffer(obj, view, flags);
26459 if (__Pyx_TypeCheck(obj, __pyx_array_type))
return __pyx_array_getbuffer(obj, view, flags);
26460 if (__Pyx_TypeCheck(obj, __pyx_memoryview_type))
return __pyx_memoryview_getbuffer(obj, view, flags);
26461 PyErr_Format(PyExc_TypeError,
"'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
26464 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
26465 PyObject *obj = view->obj;
26467 if (PyObject_CheckBuffer(obj)) {
26468 PyBuffer_Release(view);
26480 __pyx_memviewslice_is_contig(
const __Pyx_memviewslice mvs,
char order,
int ndim)
26482 int i, index, step, start;
26483 Py_ssize_t itemsize = mvs.memview->view.itemsize;
26484 if (order ==
'F') {
26491 for (i = 0; i < ndim; i++) {
26492 index = start + step * i;
26493 if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize)
26495 itemsize *= mvs.shape[index];
26502 __pyx_get_array_memory_extents(__Pyx_memviewslice *slice,
26503 void **out_start,
void **out_end,
26504 int ndim,
size_t itemsize)
26508 start = end = slice->data;
26509 for (i = 0; i < ndim; i++) {
26510 Py_ssize_t stride = slice->strides[i];
26511 Py_ssize_t extent = slice->shape[i];
26513 *out_start = *out_end = start;
26517 end += stride * (extent - 1);
26519 start += stride * (extent - 1);
26522 *out_start = start;
26523 *out_end = end + itemsize;
26526 __pyx_slices_overlap(__Pyx_memviewslice *slice1,
26527 __Pyx_memviewslice *slice2,
26528 int ndim,
size_t itemsize)
26530 void *start1, *end1, *start2, *end2;
26531 __pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize);
26532 __pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize);
26533 return (start1 < end2) && (start2 < end1);
26537 static CYTHON_INLINE PyObject *
26538 __pyx_capsule_create(
void *p, CYTHON_UNUSED
const char *sig)
26541 #if PY_VERSION_HEX >= 0x02070000
26542 cobj = PyCapsule_New(p, sig, NULL);
26544 cobj = PyCObject_FromVoidPtr(p, NULL);
26550 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
26551 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
26552 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
26553 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
26554 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
26556 func_type value = func_value;\
26557 if (sizeof(target_type) < sizeof(func_type)) {\
26558 if (unlikely(value != (func_type) (target_type) value)) {\
26559 func_type zero = 0;\
26560 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
26561 return (target_type) -1;\
26562 if (is_unsigned && unlikely(value < zero))\
26563 goto raise_neg_overflow;\
26565 goto raise_overflow;\
26568 return (target_type) value;\
26572 static CYTHON_INLINE
int __Pyx_Is_Little_Endian(
void)
26578 S.u32 = 0x01020304;
26579 return S.u8[0] == 4;
26583 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
26584 __Pyx_BufFmt_StackElem* stack,
26585 __Pyx_TypeInfo* type) {
26586 stack[0].field = &ctx->root;
26587 stack[0].parent_offset = 0;
26588 ctx->root.type = type;
26589 ctx->root.name =
"buffer dtype";
26590 ctx->root.offset = 0;
26592 ctx->head->field = &ctx->root;
26593 ctx->fmt_offset = 0;
26594 ctx->head->parent_offset = 0;
26595 ctx->new_packmode =
'@';
26596 ctx->enc_packmode =
'@';
26597 ctx->new_count = 1;
26598 ctx->enc_count = 0;
26600 ctx->is_complex = 0;
26601 ctx->is_valid_array = 0;
26602 ctx->struct_alignment = 0;
26603 while (type->typegroup ==
'S') {
26605 ctx->head->field = type->fields;
26606 ctx->head->parent_offset = 0;
26607 type = type->fields->type;
26610 static int __Pyx_BufFmt_ParseNumber(
const char** ts) {
26612 const char* t = *ts;
26613 if (*t < '0' || *t >
'9') {
26616 count = *t++ -
'0';
26617 while (*t >=
'0' && *t <=
'9') {
26619 count += *t++ -
'0';
26625 static int __Pyx_BufFmt_ExpectNumber(
const char **ts) {
26626 int number = __Pyx_BufFmt_ParseNumber(ts);
26628 PyErr_Format(PyExc_ValueError,\
26629 "Does not understand character buffer dtype format string ('%c')", **ts);
26632 static void __Pyx_BufFmt_RaiseUnexpectedChar(
char ch) {
26633 PyErr_Format(PyExc_ValueError,
26634 "Unexpected format string character: '%c'", ch);
26636 static const char* __Pyx_BufFmt_DescribeTypeChar(
char ch,
int is_complex) {
26638 case '?':
return "'bool'";
26639 case 'c':
return "'char'";
26640 case 'b':
return "'signed char'";
26641 case 'B':
return "'unsigned char'";
26642 case 'h':
return "'short'";
26643 case 'H':
return "'unsigned short'";
26644 case 'i':
return "'int'";
26645 case 'I':
return "'unsigned int'";
26646 case 'l':
return "'long'";
26647 case 'L':
return "'unsigned long'";
26648 case 'q':
return "'long long'";
26649 case 'Q':
return "'unsigned long long'";
26650 case 'f':
return (is_complex ?
"'complex float'" :
"'float'");
26651 case 'd':
return (is_complex ?
"'complex double'" :
"'double'");
26652 case 'g':
return (is_complex ?
"'complex long double'" :
"'long double'");
26653 case 'T':
return "a struct";
26654 case 'O':
return "Python object";
26655 case 'P':
return "a pointer";
26656 case 's':
case 'p':
return "a string";
26657 case 0:
return "end";
26658 default:
return "unparseable format string";
26661 static size_t __Pyx_BufFmt_TypeCharToStandardSize(
char ch,
int is_complex) {
26663 case '?':
case 'c':
case 'b':
case 'B':
case 's':
case 'p':
return 1;
26664 case 'h':
case 'H':
return 2;
26665 case 'i':
case 'I':
case 'l':
case 'L':
return 4;
26666 case 'q':
case 'Q':
return 8;
26667 case 'f':
return (is_complex ? 8 : 4);
26668 case 'd':
return (is_complex ? 16 : 8);
26670 PyErr_SetString(PyExc_ValueError,
"Python does not define a standard format string size for long double ('g')..");
26673 case 'O':
case 'P':
return sizeof(
void*);
26675 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
26679 static size_t __Pyx_BufFmt_TypeCharToNativeSize(
char ch,
int is_complex) {
26681 case '?':
case 'c':
case 'b':
case 'B':
case 's':
case 'p':
return 1;
26682 case 'h':
case 'H':
return sizeof(short);
26683 case 'i':
case 'I':
return sizeof(int);
26684 case 'l':
case 'L':
return sizeof(long);
26685 #ifdef HAVE_LONG_LONG
26686 case 'q':
case 'Q':
return sizeof(PY_LONG_LONG);
26688 case 'f':
return sizeof(float) * (is_complex ? 2 : 1);
26689 case 'd':
return sizeof(double) * (is_complex ? 2 : 1);
26690 case 'g':
return sizeof(
long double) * (is_complex ? 2 : 1);
26691 case 'O':
case 'P':
return sizeof(
void*);
26693 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
26698 typedef struct {
char c;
short x; } __Pyx_st_short;
26699 typedef struct {
char c;
int x; } __Pyx_st_int;
26700 typedef struct {
char c;
long x; } __Pyx_st_long;
26701 typedef struct {
char c;
float x; } __Pyx_st_float;
26702 typedef struct {
char c;
double x; } __Pyx_st_double;
26703 typedef struct {
char c;
long double x; } __Pyx_st_longdouble;
26704 typedef struct {
char c;
void *x; } __Pyx_st_void_p;
26705 #ifdef HAVE_LONG_LONG
26706 typedef struct {
char c; PY_LONG_LONG x; } __Pyx_st_longlong;
26708 static size_t __Pyx_BufFmt_TypeCharToAlignment(
char ch, CYTHON_UNUSED
int is_complex) {
26710 case '?':
case 'c':
case 'b':
case 'B':
case 's':
case 'p':
return 1;
26711 case 'h':
case 'H':
return sizeof(__Pyx_st_short) -
sizeof(
short);
26712 case 'i':
case 'I':
return sizeof(__Pyx_st_int) -
sizeof(
int);
26713 case 'l':
case 'L':
return sizeof(__Pyx_st_long) -
sizeof(
long);
26714 #ifdef HAVE_LONG_LONG
26715 case 'q':
case 'Q':
return sizeof(__Pyx_st_longlong) -
sizeof(PY_LONG_LONG);
26717 case 'f':
return sizeof(__Pyx_st_float) -
sizeof(
float);
26718 case 'd':
return sizeof(__Pyx_st_double) -
sizeof(
double);
26719 case 'g':
return sizeof(__Pyx_st_longdouble) -
sizeof(
long double);
26720 case 'P':
case 'O':
return sizeof(__Pyx_st_void_p) -
sizeof(
void*);
26722 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
26730 typedef struct {
short x;
char c; } __Pyx_pad_short;
26731 typedef struct {
int x;
char c; } __Pyx_pad_int;
26732 typedef struct {
long x;
char c; } __Pyx_pad_long;
26733 typedef struct {
float x;
char c; } __Pyx_pad_float;
26734 typedef struct {
double x;
char c; } __Pyx_pad_double;
26735 typedef struct {
long double x;
char c; } __Pyx_pad_longdouble;
26736 typedef struct {
void *x;
char c; } __Pyx_pad_void_p;
26737 #ifdef HAVE_LONG_LONG
26738 typedef struct { PY_LONG_LONG x;
char c; } __Pyx_pad_longlong;
26740 static size_t __Pyx_BufFmt_TypeCharToPadding(
char ch, CYTHON_UNUSED
int is_complex) {
26742 case '?':
case 'c':
case 'b':
case 'B':
case 's':
case 'p':
return 1;
26743 case 'h':
case 'H':
return sizeof(__Pyx_pad_short) -
sizeof(
short);
26744 case 'i':
case 'I':
return sizeof(__Pyx_pad_int) -
sizeof(
int);
26745 case 'l':
case 'L':
return sizeof(__Pyx_pad_long) -
sizeof(
long);
26746 #ifdef HAVE_LONG_LONG
26747 case 'q':
case 'Q':
return sizeof(__Pyx_pad_longlong) -
sizeof(PY_LONG_LONG);
26749 case 'f':
return sizeof(__Pyx_pad_float) -
sizeof(
float);
26750 case 'd':
return sizeof(__Pyx_pad_double) -
sizeof(
double);
26751 case 'g':
return sizeof(__Pyx_pad_longdouble) -
sizeof(
long double);
26752 case 'P':
case 'O':
return sizeof(__Pyx_pad_void_p) -
sizeof(
void*);
26754 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
26758 static char __Pyx_BufFmt_TypeCharToGroup(
char ch,
int is_complex) {
26762 case 'b':
case 'h':
case 'i':
26763 case 'l':
case 'q':
case 's':
case 'p':
26765 case '?':
case 'B':
case 'H':
case 'I':
case 'L':
case 'Q':
26767 case 'f':
case 'd':
case 'g':
26768 return (is_complex ?
'C' :
'R');
26774 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
26779 static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
26780 if (ctx->head == NULL || ctx->head->field == &ctx->root) {
26781 const char* expected;
26783 if (ctx->head == NULL) {
26787 expected = ctx->head->field->type->name;
26790 PyErr_Format(PyExc_ValueError,
26791 "Buffer dtype mismatch, expected %s%s%s but got %s",
26792 quote, expected, quote,
26793 __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
26795 __Pyx_StructField* field = ctx->head->field;
26796 __Pyx_StructField* parent = (ctx->head - 1)->field;
26797 PyErr_Format(PyExc_ValueError,
26798 "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
26799 field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
26800 parent->type->name, field->name);
26803 static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
26805 size_t size, offset, arraysize = 1;
26806 if (ctx->enc_type == 0)
return 0;
26807 if (ctx->head->field->type->arraysize[0]) {
26809 if (ctx->enc_type ==
's' || ctx->enc_type ==
'p') {
26810 ctx->is_valid_array = ctx->head->field->type->ndim == 1;
26812 if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
26813 PyErr_Format(PyExc_ValueError,
26814 "Expected a dimension of size %zu, got %zu",
26815 ctx->head->field->type->arraysize[0], ctx->enc_count);
26819 if (!ctx->is_valid_array) {
26820 PyErr_Format(PyExc_ValueError,
"Expected %d dimensions, got %d",
26821 ctx->head->field->type->ndim, ndim);
26824 for (i = 0; i < ctx->head->field->type->ndim; i++) {
26825 arraysize *= ctx->head->field->type->arraysize[i];
26827 ctx->is_valid_array = 0;
26828 ctx->enc_count = 1;
26830 group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
26832 __Pyx_StructField* field = ctx->head->field;
26833 __Pyx_TypeInfo* type = field->type;
26834 if (ctx->enc_packmode ==
'@' || ctx->enc_packmode ==
'^') {
26835 size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
26837 size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
26839 if (ctx->enc_packmode ==
'@') {
26840 size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
26841 size_t align_mod_offset;
26842 if (align_at == 0)
return -1;
26843 align_mod_offset = ctx->fmt_offset % align_at;
26844 if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
26845 if (ctx->struct_alignment == 0)
26846 ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
26849 if (type->size != size || type->typegroup != group) {
26850 if (type->typegroup ==
'C' && type->fields != NULL) {
26851 size_t parent_offset = ctx->head->parent_offset + field->offset;
26853 ctx->head->field = type->fields;
26854 ctx->head->parent_offset = parent_offset;
26857 if ((type->typegroup ==
'H' || group ==
'H') && type->size == size) {
26859 __Pyx_BufFmt_RaiseExpected(ctx);
26863 offset = ctx->head->parent_offset + field->offset;
26864 if (ctx->fmt_offset != offset) {
26865 PyErr_Format(PyExc_ValueError,
26866 "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T
"d but %" CYTHON_FORMAT_SSIZE_T
"d expected",
26867 (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
26870 ctx->fmt_offset += size;
26872 ctx->fmt_offset += (arraysize - 1) * size;
26875 if (field == &ctx->root) {
26877 if (ctx->enc_count != 0) {
26878 __Pyx_BufFmt_RaiseExpected(ctx);
26883 ctx->head->field = ++field;
26884 if (field->type == NULL) {
26886 field = ctx->head->field;
26888 }
else if (field->type->typegroup ==
'S') {
26889 size_t parent_offset = ctx->head->parent_offset + field->offset;
26890 if (field->type->fields->type == NULL)
continue;
26891 field = field->type->fields;
26893 ctx->head->field = field;
26894 ctx->head->parent_offset = parent_offset;
26900 }
while (ctx->enc_count);
26902 ctx->is_complex = 0;
26906 __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx,
const char** tsp)
26908 const char *ts = *tsp;
26909 int i = 0,
number, ndim;
26911 if (ctx->new_count != 1) {
26912 PyErr_SetString(PyExc_ValueError,
26913 "Cannot handle repeated arrays in format string");
26916 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
26917 ndim = ctx->head->field->type->ndim;
26918 while (*ts && *ts !=
')') {
26920 case ' ':
case '\f':
case '\r':
case '\n':
case '\t':
case '\v':
continue;
26923 number = __Pyx_BufFmt_ExpectNumber(&ts);
26924 if (
number == -1)
return NULL;
26925 if (i < ndim && (
size_t)
number != ctx->head->field->type->arraysize[i])
26926 return PyErr_Format(PyExc_ValueError,
26927 "Expected a dimension of size %zu, got %d",
26928 ctx->head->field->type->arraysize[i],
number);
26929 if (*ts !=
',' && *ts !=
')')
26930 return PyErr_Format(PyExc_ValueError,
26931 "Expected a comma in format string, got '%c'", *ts);
26932 if (*ts ==
',') ts++;
26936 return PyErr_Format(PyExc_ValueError,
"Expected %d dimension(s), got %d",
26937 ctx->head->field->type->ndim, i);
26939 PyErr_SetString(PyExc_ValueError,
26940 "Unexpected end of format string, expected ')'");
26943 ctx->is_valid_array = 1;
26944 ctx->new_count = 1;
26948 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx,
const char* ts) {
26953 if (ctx->enc_type != 0 && ctx->head == NULL) {
26954 __Pyx_BufFmt_RaiseExpected(ctx);
26957 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
26958 if (ctx->head != NULL) {
26959 __Pyx_BufFmt_RaiseExpected(ctx);
26969 if (!__Pyx_Is_Little_Endian()) {
26970 PyErr_SetString(PyExc_ValueError,
"Little-endian buffer not supported on big-endian compiler");
26973 ctx->new_packmode =
'=';
26978 if (__Pyx_Is_Little_Endian()) {
26979 PyErr_SetString(PyExc_ValueError,
"Big-endian buffer not supported on little-endian compiler");
26982 ctx->new_packmode =
'=';
26988 ctx->new_packmode = *ts++;
26992 const char* ts_after_sub;
26993 size_t i, struct_count = ctx->new_count;
26994 size_t struct_alignment = ctx->struct_alignment;
26995 ctx->new_count = 1;
26998 PyErr_SetString(PyExc_ValueError,
"Buffer acquisition: Expected '{' after 'T'");
27001 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
27003 ctx->enc_count = 0;
27004 ctx->struct_alignment = 0;
27007 for (i = 0; i != struct_count; ++i) {
27008 ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
27009 if (!ts_after_sub)
return NULL;
27012 if (struct_alignment) ctx->struct_alignment = struct_alignment;
27017 size_t alignment = ctx->struct_alignment;
27019 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
27021 if (alignment && ctx->fmt_offset % alignment) {
27022 ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
27027 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
27028 ctx->fmt_offset += ctx->new_count;
27029 ctx->new_count = 1;
27030 ctx->enc_count = 0;
27032 ctx->enc_packmode = ctx->new_packmode;
27038 if (*ts !=
'f' && *ts !=
'd' && *ts !=
'g') {
27039 __Pyx_BufFmt_RaiseUnexpectedChar(
'Z');
27042 CYTHON_FALLTHROUGH;
27043 case '?':
case 'c':
case 'b':
case 'B':
case 'h':
case 'H':
case 'i':
case 'I':
27044 case 'l':
case 'L':
case 'q':
case 'Q':
27045 case 'f':
case 'd':
case 'g':
27046 case 'O':
case 'p':
27047 if ((ctx->enc_type == *ts) && (got_Z == ctx->is_complex) &&
27048 (ctx->enc_packmode == ctx->new_packmode) && (!ctx->is_valid_array)) {
27049 ctx->enc_count += ctx->new_count;
27050 ctx->new_count = 1;
27055 CYTHON_FALLTHROUGH;
27057 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
27058 ctx->enc_count = ctx->new_count;
27059 ctx->enc_packmode = ctx->new_packmode;
27060 ctx->enc_type = *ts;
27061 ctx->is_complex = got_Z;
27063 ctx->new_count = 1;
27068 while(*ts !=
':') ++ts;
27072 if (!__pyx_buffmt_parse_array(ctx, &ts))
return NULL;
27076 int number = __Pyx_BufFmt_ExpectNumber(&ts);
27077 if (
number == -1)
return NULL;
27078 ctx->new_count = (size_t)
number;
27086 __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
27093 if (a->size != b->size || a->typegroup != b->typegroup ||
27094 a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
27095 if (a->typegroup ==
'H' || b->typegroup ==
'H') {
27096 return a->size == b->size;
27102 for (i = 0; i < a->ndim; i++)
27103 if (a->arraysize[i] != b->arraysize[i])
27106 if (a->typegroup ==
'S') {
27107 if (a->flags != b->flags)
27109 if (a->fields || b->fields) {
27110 if (!(a->fields && b->fields))
27112 for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
27113 __Pyx_StructField *field_a = a->fields + i;
27114 __Pyx_StructField *field_b = b->fields + i;
27115 if (field_a->offset != field_b->offset ||
27116 !__pyx_typeinfo_cmp(field_a->type, field_b->type))
27119 return !a->fields[i].type && !b->fields[i].type;
27127 __pyx_check_strides(Py_buffer *buf,
int dim,
int ndim,
int spec)
27129 if (buf->shape[dim] <= 1)
27131 if (buf->strides) {
27132 if (spec & __Pyx_MEMVIEW_CONTIG) {
27133 if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
27134 if (unlikely(buf->strides[dim] !=
sizeof(
void *))) {
27135 PyErr_Format(PyExc_ValueError,
27136 "Buffer is not indirectly contiguous "
27137 "in dimension %d.", dim);
27140 }
else if (unlikely(buf->strides[dim] != buf->itemsize)) {
27141 PyErr_SetString(PyExc_ValueError,
27142 "Buffer and memoryview are not contiguous "
27143 "in the same dimension.");
27147 if (spec & __Pyx_MEMVIEW_FOLLOW) {
27148 Py_ssize_t stride = buf->strides[dim];
27151 if (unlikely(stride < buf->itemsize)) {
27152 PyErr_SetString(PyExc_ValueError,
27153 "Buffer and memoryview are not contiguous "
27154 "in the same dimension.");
27159 if (unlikely(spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1)) {
27160 PyErr_Format(PyExc_ValueError,
27161 "C-contiguous buffer is not contiguous in "
27162 "dimension %d", dim);
27164 }
else if (unlikely(spec & (__Pyx_MEMVIEW_PTR))) {
27165 PyErr_Format(PyExc_ValueError,
27166 "C-contiguous buffer is not indirect in "
27167 "dimension %d", dim);
27169 }
else if (unlikely(buf->suboffsets)) {
27170 PyErr_SetString(PyExc_ValueError,
27171 "Buffer exposes suboffsets but no strides");
27180 __pyx_check_suboffsets(Py_buffer *buf,
int dim, CYTHON_UNUSED
int ndim,
int spec)
27182 if (spec & __Pyx_MEMVIEW_DIRECT) {
27183 if (unlikely(buf->suboffsets && buf->suboffsets[dim] >= 0)) {
27184 PyErr_Format(PyExc_ValueError,
27185 "Buffer not compatible with direct access "
27186 "in dimension %d.", dim);
27190 if (spec & __Pyx_MEMVIEW_PTR) {
27191 if (unlikely(!buf->suboffsets || (buf->suboffsets[dim] < 0))) {
27192 PyErr_Format(PyExc_ValueError,
27193 "Buffer is not indirectly accessible "
27194 "in dimension %d.", dim);
27203 __pyx_verify_contig(Py_buffer *buf,
int ndim,
int c_or_f_flag)
27206 if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
27207 Py_ssize_t stride = 1;
27208 for (i = 0; i < ndim; i++) {
27209 if (unlikely(stride * buf->itemsize != buf->strides[i] && buf->shape[i] > 1)) {
27210 PyErr_SetString(PyExc_ValueError,
27211 "Buffer not fortran contiguous.");
27214 stride = stride * buf->shape[i];
27216 }
else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
27217 Py_ssize_t stride = 1;
27218 for (i = ndim - 1; i >- 1; i--) {
27219 if (unlikely(stride * buf->itemsize != buf->strides[i] && buf->shape[i] > 1)) {
27220 PyErr_SetString(PyExc_ValueError,
27221 "Buffer not C contiguous.");
27224 stride = stride * buf->shape[i];
27231 static int __Pyx_ValidateAndInit_memviewslice(
27236 __Pyx_TypeInfo *dtype,
27237 __Pyx_BufFmt_StackElem stack[],
27238 __Pyx_memviewslice *memviewslice,
27239 PyObject *original_obj)
27241 struct __pyx_memoryview_obj *memview, *new_memview;
27242 __Pyx_RefNannyDeclarations
27244 int i, spec = 0, retval = -1;
27245 __Pyx_BufFmt_Context ctx;
27246 int from_memoryview = __pyx_memoryview_check(original_obj);
27247 __Pyx_RefNannySetupContext(
"ValidateAndInit_memviewslice", 0);
27248 if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((
struct __pyx_memoryview_obj *)
27249 original_obj)->typeinfo)) {
27250 memview = (
struct __pyx_memoryview_obj *) original_obj;
27251 new_memview = NULL;
27253 memview = (
struct __pyx_memoryview_obj *) __pyx_memoryview_new(
27254 original_obj, buf_flags, 0, dtype);
27255 new_memview = memview;
27256 if (unlikely(!memview))
27259 buf = &memview->view;
27260 if (unlikely(buf->ndim != ndim)) {
27261 PyErr_Format(PyExc_ValueError,
27262 "Buffer has wrong number of dimensions (expected %d, got %d)",
27267 __Pyx_BufFmt_Init(&ctx, stack, dtype);
27268 if (unlikely(!__Pyx_BufFmt_CheckString(&ctx, buf->format)))
goto fail;
27270 if (unlikely((
unsigned) buf->itemsize != dtype->size)) {
27271 PyErr_Format(PyExc_ValueError,
27272 "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T
"u byte%s) "
27273 "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T
"u byte%s)",
27275 (buf->itemsize > 1) ?
"s" :
"",
27278 (dtype->size > 1) ?
"s" :
"");
27281 if (buf->len > 0) {
27282 for (i = 0; i < ndim; i++) {
27283 spec = axes_specs[i];
27284 if (unlikely(!__pyx_check_strides(buf, i, ndim, spec)))
27286 if (unlikely(!__pyx_check_suboffsets(buf, i, ndim, spec)))
27289 if (unlikely(buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag)))
27292 if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
27293 new_memview != NULL) == -1)) {
27299 Py_XDECREF(new_memview);
27302 __Pyx_RefNannyFinishContext();
27307 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_double(PyObject *obj,
int writable_flag) {
27308 __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
27309 __Pyx_BufFmt_StackElem stack[1];
27310 int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
27312 if (obj == Py_None) {
27313 result.memview = (
struct __pyx_memoryview_obj *) Py_None;
27316 retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
27317 PyBUF_RECORDS_RO | writable_flag, 1,
27318 &__Pyx_TypeInfo_double, stack,
27320 if (unlikely(retcode == -1))
27324 result.memview = NULL;
27325 result.data = NULL;
27330 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_int(PyObject *obj,
int writable_flag) {
27331 __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
27332 __Pyx_BufFmt_StackElem stack[1];
27333 int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
27335 if (obj == Py_None) {
27336 result.memview = (
struct __pyx_memoryview_obj *) Py_None;
27339 retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
27340 PyBUF_RECORDS_RO | writable_flag, 1,
27341 &__Pyx_TypeInfo_int, stack,
27343 if (unlikely(retcode == -1))
27347 result.memview = NULL;
27348 result.data = NULL;
27353 #if CYTHON_CCOMPLEX
27355 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(
float x,
float y) {
27356 return ::std::complex< float >(x, y);
27359 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(
float x,
float y) {
27360 return x + y*(__pyx_t_float_complex)_Complex_I;
27364 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(
float x,
float y) {
27365 __pyx_t_float_complex
z;
27373 #if CYTHON_CCOMPLEX
27375 static CYTHON_INLINE
int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
27376 return (a.real == b.real) && (a.imag == b.imag);
27378 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
27379 __pyx_t_float_complex
z;
27380 z.real = a.real + b.real;
27381 z.imag = a.imag + b.imag;
27384 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
27385 __pyx_t_float_complex
z;
27386 z.real = a.real - b.real;
27387 z.imag = a.imag - b.imag;
27390 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
27391 __pyx_t_float_complex
z;
27392 z.real = a.real * b.real - a.imag * b.imag;
27393 z.imag = a.real * b.imag + a.imag * b.real;
27397 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
27399 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
27400 }
else if (fabsf(b.real) >= fabsf(b.imag)) {
27401 if (b.real == 0 && b.imag == 0) {
27402 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
27404 float r = b.imag / b.real;
27405 float s = (float)(1.0) / (b.real + b.imag *
r);
27406 return __pyx_t_float_complex_from_parts(
27407 (a.real + a.imag *
r) *
s, (a.imag - a.real *
r) *
s);
27410 float r = b.real / b.imag;
27411 float s = (float)(1.0) / (b.imag + b.real *
r);
27412 return __pyx_t_float_complex_from_parts(
27413 (a.real *
r + a.imag) *
s, (a.imag *
r - a.real) *
s);
27417 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
27419 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
27421 float denom = b.real * b.real + b.imag * b.imag;
27422 return __pyx_t_float_complex_from_parts(
27423 (a.real * b.real + a.imag * b.imag) / denom,
27424 (a.imag * b.real - a.real * b.imag) / denom);
27428 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
27429 __pyx_t_float_complex
z;
27434 static CYTHON_INLINE
int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
27435 return (a.real == 0) && (a.imag == 0);
27437 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
27438 __pyx_t_float_complex
z;
27444 static CYTHON_INLINE
float __Pyx_c_abs_float(__pyx_t_float_complex
z) {
27445 #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
27446 return sqrtf(
z.real*
z.real +
z.imag*
z.imag);
27448 return hypotf(
z.real,
z.imag);
27451 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
27452 __pyx_t_float_complex
z;
27453 float r, lnr, theta, z_r, z_theta;
27454 if (b.imag == 0 && b.real == (
int)b.real) {
27456 float denom = a.real * a.real + a.imag * a.imag;
27457 a.real = a.real / denom;
27458 a.imag = -a.imag / denom;
27461 switch ((
int)b.real) {
27469 return __Pyx_c_prod_float(a, a);
27471 z = __Pyx_c_prod_float(a, a);
27472 return __Pyx_c_prod_float(
z, a);
27474 z = __Pyx_c_prod_float(a, a);
27475 return __Pyx_c_prod_float(
z,
z);
27481 }
else if (b.imag == 0) {
27482 z.real = powf(a.real, b.real);
27485 }
else if (a.real > 0) {
27490 theta = atan2f(0.0, -1.0);
27493 r = __Pyx_c_abs_float(a);
27494 theta = atan2f(a.imag, a.real);
27497 z_r = expf(lnr * b.real - theta * b.imag);
27498 z_theta = theta * b.real + lnr * b.imag;
27499 z.real = z_r * cosf(z_theta);
27500 z.imag = z_r * sinf(z_theta);
27507 #if CYTHON_CCOMPLEX
27509 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(
double x,
double y) {
27510 return ::std::complex< double >(x, y);
27513 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(
double x,
double y) {
27514 return x + y*(__pyx_t_double_complex)_Complex_I;
27518 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(
double x,
double y) {
27519 __pyx_t_double_complex
z;
27527 #if CYTHON_CCOMPLEX
27529 static CYTHON_INLINE
int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
27530 return (a.real == b.real) && (a.imag == b.imag);
27532 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
27533 __pyx_t_double_complex
z;
27534 z.real = a.real + b.real;
27535 z.imag = a.imag + b.imag;
27538 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
27539 __pyx_t_double_complex
z;
27540 z.real = a.real - b.real;
27541 z.imag = a.imag - b.imag;
27544 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
27545 __pyx_t_double_complex
z;
27546 z.real = a.real * b.real - a.imag * b.imag;
27547 z.imag = a.real * b.imag + a.imag * b.real;
27551 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
27553 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
27554 }
else if (fabs(b.real) >= fabs(b.imag)) {
27555 if (b.real == 0 && b.imag == 0) {
27556 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
27558 double r = b.imag / b.real;
27559 double s = (double)(1.0) / (b.real + b.imag *
r);
27560 return __pyx_t_double_complex_from_parts(
27561 (a.real + a.imag *
r) *
s, (a.imag - a.real *
r) *
s);
27564 double r = b.real / b.imag;
27565 double s = (double)(1.0) / (b.imag + b.real *
r);
27566 return __pyx_t_double_complex_from_parts(
27567 (a.real *
r + a.imag) *
s, (a.imag *
r - a.real) *
s);
27571 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
27573 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
27575 double denom = b.real * b.real + b.imag * b.imag;
27576 return __pyx_t_double_complex_from_parts(
27577 (a.real * b.real + a.imag * b.imag) / denom,
27578 (a.imag * b.real - a.real * b.imag) / denom);
27582 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
27583 __pyx_t_double_complex
z;
27588 static CYTHON_INLINE
int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
27589 return (a.real == 0) && (a.imag == 0);
27591 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
27592 __pyx_t_double_complex
z;
27598 static CYTHON_INLINE
double __Pyx_c_abs_double(__pyx_t_double_complex
z) {
27599 #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
27600 return sqrt(
z.real*
z.real +
z.imag*
z.imag);
27602 return hypot(
z.real,
z.imag);
27605 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
27606 __pyx_t_double_complex
z;
27607 double r, lnr, theta, z_r, z_theta;
27608 if (b.imag == 0 && b.real == (
int)b.real) {
27610 double denom = a.real * a.real + a.imag * a.imag;
27611 a.real = a.real / denom;
27612 a.imag = -a.imag / denom;
27615 switch ((
int)b.real) {
27623 return __Pyx_c_prod_double(a, a);
27625 z = __Pyx_c_prod_double(a, a);
27626 return __Pyx_c_prod_double(
z, a);
27628 z = __Pyx_c_prod_double(a, a);
27629 return __Pyx_c_prod_double(
z,
z);
27635 }
else if (b.imag == 0) {
27636 z.real = pow(a.real, b.real);
27639 }
else if (a.real > 0) {
27644 theta = atan2(0.0, -1.0);
27647 r = __Pyx_c_abs_double(a);
27648 theta = atan2(a.imag, a.real);
27651 z_r = exp(lnr * b.real - theta * b.imag);
27652 z_theta = theta * b.real + lnr * b.imag;
27653 z.real = z_r * cos(z_theta);
27654 z.imag = z_r * sin(z_theta);
27661 static __Pyx_memviewslice
27662 __pyx_memoryview_copy_new_contig(
const __Pyx_memviewslice *from_mvs,
27663 const char *mode,
int ndim,
27664 size_t sizeof_dtype,
int contig_flag,
27665 int dtype_is_object)
27667 __Pyx_RefNannyDeclarations
27669 __Pyx_memviewslice new_mvs = { 0, 0, { 0 }, { 0 }, { 0 } };
27670 struct __pyx_memoryview_obj *from_memview = from_mvs->memview;
27671 Py_buffer *buf = &from_memview->view;
27672 PyObject *shape_tuple = NULL;
27673 PyObject *temp_int = NULL;
27674 struct __pyx_array_obj *array_obj = NULL;
27675 struct __pyx_memoryview_obj *memview_obj = NULL;
27676 __Pyx_RefNannySetupContext(
"__pyx_memoryview_copy_new_contig", 0);
27677 for (i = 0; i < ndim; i++) {
27678 if (unlikely(from_mvs->suboffsets[i] >= 0)) {
27679 PyErr_Format(PyExc_ValueError,
"Cannot copy memoryview slice with "
27680 "indirect dimensions (axis %d)", i);
27684 shape_tuple = PyTuple_New(ndim);
27685 if (unlikely(!shape_tuple)) {
27688 __Pyx_GOTREF(shape_tuple);
27689 for(i = 0; i < ndim; i++) {
27690 temp_int = PyInt_FromSsize_t(from_mvs->shape[i]);
27691 if(unlikely(!temp_int)) {
27694 PyTuple_SET_ITEM(shape_tuple, i, temp_int);
27698 array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, (
char *) mode, NULL);
27699 if (unlikely(!array_obj)) {
27702 __Pyx_GOTREF(array_obj);
27703 memview_obj = (
struct __pyx_memoryview_obj *) __pyx_memoryview_new(
27704 (PyObject *) array_obj, contig_flag,
27706 from_mvs->memview->typeinfo);
27707 if (unlikely(!memview_obj))
27709 if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0))
27711 if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim,
27712 dtype_is_object) < 0))
27716 __Pyx_XDECREF(new_mvs.memview);
27717 new_mvs.memview = NULL;
27718 new_mvs.data = NULL;
27720 __Pyx_XDECREF(shape_tuple);
27721 __Pyx_XDECREF(temp_int);
27722 __Pyx_XDECREF(array_obj);
27723 __Pyx_RefNannyFinishContext();
27728 static CYTHON_INLINE
int __Pyx_PyInt_As_int(PyObject *x) {
27729 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27730 #pragma GCC diagnostic push
27731 #pragma GCC diagnostic ignored "-Wconversion"
27733 const int neg_one = (int) -1, const_zero = (
int) 0;
27734 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27735 #pragma GCC diagnostic pop
27737 const int is_unsigned = neg_one > const_zero;
27738 #if PY_MAJOR_VERSION < 3
27739 if (likely(PyInt_Check(x))) {
27740 if (
sizeof(
int) <
sizeof(long)) {
27741 __PYX_VERIFY_RETURN_INT(
int,
long, PyInt_AS_LONG(x))
27743 long val = PyInt_AS_LONG(x);
27744 if (is_unsigned && unlikely(val < 0)) {
27745 goto raise_neg_overflow;
27751 if (likely(PyLong_Check(x))) {
27753 #if CYTHON_USE_PYLONG_INTERNALS
27754 const digit* digits = ((PyLongObject*)x)->ob_digit;
27755 switch (Py_SIZE(x)) {
27756 case 0:
return (
int) 0;
27757 case 1: __PYX_VERIFY_RETURN_INT(
int, digit, digits[0])
27759 if (8 *
sizeof(
int) > 1 * PyLong_SHIFT) {
27760 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
27761 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27762 }
else if (8 *
sizeof(
int) >= 2 * PyLong_SHIFT) {
27763 return (
int) (((((int)digits[1]) << PyLong_SHIFT) | (
int)digits[0]));
27768 if (8 *
sizeof(
int) > 2 * PyLong_SHIFT) {
27769 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
27770 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27771 }
else if (8 *
sizeof(
int) >= 3 * PyLong_SHIFT) {
27772 return (
int) (((((((int)digits[2]) << PyLong_SHIFT) | (
int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
27777 if (8 *
sizeof(
int) > 3 * PyLong_SHIFT) {
27778 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
27779 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27780 }
else if (8 *
sizeof(
int) >= 4 * PyLong_SHIFT) {
27781 return (
int) (((((((((int)digits[3]) << PyLong_SHIFT) | (
int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (
int)digits[0]));
27787 #if CYTHON_COMPILING_IN_CPYTHON
27788 if (unlikely(Py_SIZE(x) < 0)) {
27789 goto raise_neg_overflow;
27793 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
27794 if (unlikely(result < 0))
27796 if (unlikely(result == 1))
27797 goto raise_neg_overflow;
27800 if (
sizeof(
int) <=
sizeof(
unsigned long)) {
27801 __PYX_VERIFY_RETURN_INT_EXC(
int,
unsigned long, PyLong_AsUnsignedLong(x))
27802 #ifdef HAVE_LONG_LONG
27803 }
else if (
sizeof(
int) <=
sizeof(
unsigned PY_LONG_LONG)) {
27804 __PYX_VERIFY_RETURN_INT_EXC(
int,
unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
27808 #if CYTHON_USE_PYLONG_INTERNALS
27809 const digit* digits = ((PyLongObject*)x)->ob_digit;
27810 switch (Py_SIZE(x)) {
27811 case 0:
return (
int) 0;
27812 case -1: __PYX_VERIFY_RETURN_INT(
int, sdigit, (sdigit) (-(sdigit)digits[0]))
27813 case 1: __PYX_VERIFY_RETURN_INT(
int, digit, +digits[0])
27815 if (8 *
sizeof(
int) - 1 > 1 * PyLong_SHIFT) {
27816 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
27817 __PYX_VERIFY_RETURN_INT(
int,
long, -(
long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27818 }
else if (8 *
sizeof(
int) - 1 > 2 * PyLong_SHIFT) {
27819 return (
int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
27824 if (8 *
sizeof(
int) > 1 * PyLong_SHIFT) {
27825 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
27826 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27827 }
else if (8 *
sizeof(
int) - 1 > 2 * PyLong_SHIFT) {
27828 return (
int) ((((((int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
27833 if (8 *
sizeof(
int) - 1 > 2 * PyLong_SHIFT) {
27834 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
27835 __PYX_VERIFY_RETURN_INT(
int,
long, -(
long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27836 }
else if (8 *
sizeof(
int) - 1 > 3 * PyLong_SHIFT) {
27837 return (
int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (
int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
27842 if (8 *
sizeof(
int) > 2 * PyLong_SHIFT) {
27843 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
27844 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27845 }
else if (8 *
sizeof(
int) - 1 > 3 * PyLong_SHIFT) {
27846 return (
int) ((((((((int)digits[2]) << PyLong_SHIFT) | (
int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
27851 if (8 *
sizeof(
int) - 1 > 3 * PyLong_SHIFT) {
27852 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
27853 __PYX_VERIFY_RETURN_INT(
int,
long, -(
long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27854 }
else if (8 *
sizeof(
int) - 1 > 4 * PyLong_SHIFT) {
27855 return (
int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (
int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
27860 if (8 *
sizeof(
int) > 3 * PyLong_SHIFT) {
27861 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
27862 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27863 }
else if (8 *
sizeof(
int) - 1 > 4 * PyLong_SHIFT) {
27864 return (
int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (
int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
27870 if (
sizeof(
int) <=
sizeof(long)) {
27871 __PYX_VERIFY_RETURN_INT_EXC(
int,
long, PyLong_AsLong(x))
27872 #ifdef HAVE_LONG_LONG
27873 }
else if (
sizeof(
int) <=
sizeof(PY_LONG_LONG)) {
27874 __PYX_VERIFY_RETURN_INT_EXC(
int, PY_LONG_LONG, PyLong_AsLongLong(x))
27879 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
27880 PyErr_SetString(PyExc_RuntimeError,
27881 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
27884 PyObject *
v = __Pyx_PyNumber_IntOrLong(x);
27885 #if PY_MAJOR_VERSION < 3
27886 if (likely(
v) && !PyLong_Check(
v)) {
27888 v = PyNumber_Long(tmp);
27893 int one = 1;
int is_little = (int)*(
unsigned char *)&one;
27894 unsigned char *bytes = (
unsigned char *)&val;
27895 int ret = _PyLong_AsByteArray((PyLongObject *)
v,
27896 bytes,
sizeof(val),
27897 is_little, !is_unsigned);
27907 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
27908 if (!tmp)
return (
int) -1;
27909 val = __Pyx_PyInt_As_int(tmp);
27914 PyErr_SetString(PyExc_OverflowError,
27915 "value too large to convert to int");
27917 raise_neg_overflow:
27918 PyErr_SetString(PyExc_OverflowError,
27919 "can't convert negative value to int");
27924 static CYTHON_INLINE
long __Pyx_PyInt_As_long(PyObject *x) {
27925 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27926 #pragma GCC diagnostic push
27927 #pragma GCC diagnostic ignored "-Wconversion"
27929 const long neg_one = (long) -1, const_zero = (
long) 0;
27930 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27931 #pragma GCC diagnostic pop
27933 const int is_unsigned = neg_one > const_zero;
27934 #if PY_MAJOR_VERSION < 3
27935 if (likely(PyInt_Check(x))) {
27936 if (
sizeof(
long) <
sizeof(long)) {
27937 __PYX_VERIFY_RETURN_INT(
long,
long, PyInt_AS_LONG(x))
27939 long val = PyInt_AS_LONG(x);
27940 if (is_unsigned && unlikely(val < 0)) {
27941 goto raise_neg_overflow;
27947 if (likely(PyLong_Check(x))) {
27949 #if CYTHON_USE_PYLONG_INTERNALS
27950 const digit* digits = ((PyLongObject*)x)->ob_digit;
27951 switch (Py_SIZE(x)) {
27952 case 0:
return (
long) 0;
27953 case 1: __PYX_VERIFY_RETURN_INT(
long, digit, digits[0])
27955 if (8 *
sizeof(
long) > 1 * PyLong_SHIFT) {
27956 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
27957 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27958 }
else if (8 *
sizeof(
long) >= 2 * PyLong_SHIFT) {
27959 return (
long) (((((long)digits[1]) << PyLong_SHIFT) | (
long)digits[0]));
27964 if (8 *
sizeof(
long) > 2 * PyLong_SHIFT) {
27965 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
27966 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27967 }
else if (8 *
sizeof(
long) >= 3 * PyLong_SHIFT) {
27968 return (
long) (((((((long)digits[2]) << PyLong_SHIFT) | (
long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
27973 if (8 *
sizeof(
long) > 3 * PyLong_SHIFT) {
27974 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
27975 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27976 }
else if (8 *
sizeof(
long) >= 4 * PyLong_SHIFT) {
27977 return (
long) (((((((((long)digits[3]) << PyLong_SHIFT) | (
long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (
long)digits[0]));
27983 #if CYTHON_COMPILING_IN_CPYTHON
27984 if (unlikely(Py_SIZE(x) < 0)) {
27985 goto raise_neg_overflow;
27989 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
27990 if (unlikely(result < 0))
27992 if (unlikely(result == 1))
27993 goto raise_neg_overflow;
27996 if (
sizeof(
long) <=
sizeof(
unsigned long)) {
27997 __PYX_VERIFY_RETURN_INT_EXC(
long,
unsigned long, PyLong_AsUnsignedLong(x))
27998 #ifdef HAVE_LONG_LONG
27999 }
else if (
sizeof(
long) <=
sizeof(
unsigned PY_LONG_LONG)) {
28000 __PYX_VERIFY_RETURN_INT_EXC(
long,
unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
28004 #if CYTHON_USE_PYLONG_INTERNALS
28005 const digit* digits = ((PyLongObject*)x)->ob_digit;
28006 switch (Py_SIZE(x)) {
28007 case 0:
return (
long) 0;
28008 case -1: __PYX_VERIFY_RETURN_INT(
long, sdigit, (sdigit) (-(sdigit)digits[0]))
28009 case 1: __PYX_VERIFY_RETURN_INT(
long, digit, +digits[0])
28011 if (8 *
sizeof(
long) - 1 > 1 * PyLong_SHIFT) {
28012 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
28013 __PYX_VERIFY_RETURN_INT(
long,
long, -(
long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28014 }
else if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
28015 return (
long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
28020 if (8 *
sizeof(
long) > 1 * PyLong_SHIFT) {
28021 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
28022 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28023 }
else if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
28024 return (
long) ((((((long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
28029 if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
28030 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
28031 __PYX_VERIFY_RETURN_INT(
long,
long, -(
long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28032 }
else if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
28033 return (
long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (
long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
28038 if (8 *
sizeof(
long) > 2 * PyLong_SHIFT) {
28039 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
28040 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28041 }
else if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
28042 return (
long) ((((((((long)digits[2]) << PyLong_SHIFT) | (
long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
28047 if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
28048 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
28049 __PYX_VERIFY_RETURN_INT(
long,
long, -(
long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28050 }
else if (8 *
sizeof(
long) - 1 > 4 * PyLong_SHIFT) {
28051 return (
long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (
long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
28056 if (8 *
sizeof(
long) > 3 * PyLong_SHIFT) {
28057 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
28058 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28059 }
else if (8 *
sizeof(
long) - 1 > 4 * PyLong_SHIFT) {
28060 return (
long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (
long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
28066 if (
sizeof(
long) <=
sizeof(long)) {
28067 __PYX_VERIFY_RETURN_INT_EXC(
long,
long, PyLong_AsLong(x))
28068 #ifdef HAVE_LONG_LONG
28069 }
else if (
sizeof(
long) <=
sizeof(PY_LONG_LONG)) {
28070 __PYX_VERIFY_RETURN_INT_EXC(
long, PY_LONG_LONG, PyLong_AsLongLong(x))
28075 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
28076 PyErr_SetString(PyExc_RuntimeError,
28077 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
28080 PyObject *
v = __Pyx_PyNumber_IntOrLong(x);
28081 #if PY_MAJOR_VERSION < 3
28082 if (likely(
v) && !PyLong_Check(
v)) {
28084 v = PyNumber_Long(tmp);
28089 int one = 1;
int is_little = (int)*(
unsigned char *)&one;
28090 unsigned char *bytes = (
unsigned char *)&val;
28091 int ret = _PyLong_AsByteArray((PyLongObject *)
v,
28092 bytes,
sizeof(val),
28093 is_little, !is_unsigned);
28103 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
28104 if (!tmp)
return (
long) -1;
28105 val = __Pyx_PyInt_As_long(tmp);
28110 PyErr_SetString(PyExc_OverflowError,
28111 "value too large to convert to long");
28113 raise_neg_overflow:
28114 PyErr_SetString(PyExc_OverflowError,
28115 "can't convert negative value to long");
28120 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(
int value) {
28121 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
28122 #pragma GCC diagnostic push
28123 #pragma GCC diagnostic ignored "-Wconversion"
28125 const int neg_one = (int) -1, const_zero = (
int) 0;
28126 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
28127 #pragma GCC diagnostic pop
28129 const int is_unsigned = neg_one > const_zero;
28131 if (
sizeof(
int) <
sizeof(long)) {
28132 return PyInt_FromLong((
long) value);
28133 }
else if (
sizeof(
int) <=
sizeof(
unsigned long)) {
28134 return PyLong_FromUnsignedLong((
unsigned long) value);
28135 #ifdef HAVE_LONG_LONG
28136 }
else if (
sizeof(
int) <=
sizeof(
unsigned PY_LONG_LONG)) {
28137 return PyLong_FromUnsignedLongLong((
unsigned PY_LONG_LONG) value);
28141 if (
sizeof(
int) <=
sizeof(
long)) {
28142 return PyInt_FromLong((
long) value);
28143 #ifdef HAVE_LONG_LONG
28144 }
else if (
sizeof(
int) <=
sizeof(PY_LONG_LONG)) {
28145 return PyLong_FromLongLong((PY_LONG_LONG) value);
28150 int one = 1;
int little = (int)*(
unsigned char *)&one;
28151 unsigned char *bytes = (
unsigned char *)&value;
28152 return _PyLong_FromByteArray(bytes,
sizeof(
int),
28153 little, !is_unsigned);
28158 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(
long value) {
28159 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
28160 #pragma GCC diagnostic push
28161 #pragma GCC diagnostic ignored "-Wconversion"
28163 const long neg_one = (long) -1, const_zero = (
long) 0;
28164 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
28165 #pragma GCC diagnostic pop
28167 const int is_unsigned = neg_one > const_zero;
28169 if (
sizeof(
long) <
sizeof(long)) {
28170 return PyInt_FromLong((
long) value);
28171 }
else if (
sizeof(
long) <=
sizeof(
unsigned long)) {
28172 return PyLong_FromUnsignedLong((
unsigned long) value);
28173 #ifdef HAVE_LONG_LONG
28174 }
else if (
sizeof(
long) <=
sizeof(
unsigned PY_LONG_LONG)) {
28175 return PyLong_FromUnsignedLongLong((
unsigned PY_LONG_LONG) value);
28179 if (
sizeof(
long) <=
sizeof(
long)) {
28180 return PyInt_FromLong((
long) value);
28181 #ifdef HAVE_LONG_LONG
28182 }
else if (
sizeof(
long) <=
sizeof(PY_LONG_LONG)) {
28183 return PyLong_FromLongLong((PY_LONG_LONG) value);
28188 int one = 1;
int little = (int)*(
unsigned char *)&one;
28189 unsigned char *bytes = (
unsigned char *)&value;
28190 return _PyLong_FromByteArray(bytes,
sizeof(
long),
28191 little, !is_unsigned);
28196 static CYTHON_INLINE
char __Pyx_PyInt_As_char(PyObject *x) {
28197 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
28198 #pragma GCC diagnostic push
28199 #pragma GCC diagnostic ignored "-Wconversion"
28201 const char neg_one = (char) -1, const_zero = (
char) 0;
28202 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
28203 #pragma GCC diagnostic pop
28205 const int is_unsigned = neg_one > const_zero;
28206 #if PY_MAJOR_VERSION < 3
28207 if (likely(PyInt_Check(x))) {
28208 if (
sizeof(
char) <
sizeof(long)) {
28209 __PYX_VERIFY_RETURN_INT(
char,
long, PyInt_AS_LONG(x))
28211 long val = PyInt_AS_LONG(x);
28212 if (is_unsigned && unlikely(val < 0)) {
28213 goto raise_neg_overflow;
28219 if (likely(PyLong_Check(x))) {
28221 #if CYTHON_USE_PYLONG_INTERNALS
28222 const digit* digits = ((PyLongObject*)x)->ob_digit;
28223 switch (Py_SIZE(x)) {
28224 case 0:
return (
char) 0;
28225 case 1: __PYX_VERIFY_RETURN_INT(
char, digit, digits[0])
28227 if (8 *
sizeof(
char) > 1 * PyLong_SHIFT) {
28228 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
28229 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28230 }
else if (8 *
sizeof(
char) >= 2 * PyLong_SHIFT) {
28231 return (
char) (((((char)digits[1]) << PyLong_SHIFT) | (
char)digits[0]));
28236 if (8 *
sizeof(
char) > 2 * PyLong_SHIFT) {
28237 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
28238 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28239 }
else if (8 *
sizeof(
char) >= 3 * PyLong_SHIFT) {
28240 return (
char) (((((((char)digits[2]) << PyLong_SHIFT) | (
char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
28245 if (8 *
sizeof(
char) > 3 * PyLong_SHIFT) {
28246 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
28247 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28248 }
else if (8 *
sizeof(
char) >= 4 * PyLong_SHIFT) {
28249 return (
char) (((((((((char)digits[3]) << PyLong_SHIFT) | (
char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (
char)digits[0]));
28255 #if CYTHON_COMPILING_IN_CPYTHON
28256 if (unlikely(Py_SIZE(x) < 0)) {
28257 goto raise_neg_overflow;
28261 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
28262 if (unlikely(result < 0))
28264 if (unlikely(result == 1))
28265 goto raise_neg_overflow;
28268 if (
sizeof(
char) <=
sizeof(
unsigned long)) {
28269 __PYX_VERIFY_RETURN_INT_EXC(
char,
unsigned long, PyLong_AsUnsignedLong(x))
28270 #ifdef HAVE_LONG_LONG
28271 }
else if (
sizeof(
char) <=
sizeof(
unsigned PY_LONG_LONG)) {
28272 __PYX_VERIFY_RETURN_INT_EXC(
char,
unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
28276 #if CYTHON_USE_PYLONG_INTERNALS
28277 const digit* digits = ((PyLongObject*)x)->ob_digit;
28278 switch (Py_SIZE(x)) {
28279 case 0:
return (
char) 0;
28280 case -1: __PYX_VERIFY_RETURN_INT(
char, sdigit, (sdigit) (-(sdigit)digits[0]))
28281 case 1: __PYX_VERIFY_RETURN_INT(
char, digit, +digits[0])
28283 if (8 *
sizeof(
char) - 1 > 1 * PyLong_SHIFT) {
28284 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
28285 __PYX_VERIFY_RETURN_INT(
char,
long, -(
long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28286 }
else if (8 *
sizeof(
char) - 1 > 2 * PyLong_SHIFT) {
28287 return (
char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (
char)digits[0])));
28292 if (8 *
sizeof(
char) > 1 * PyLong_SHIFT) {
28293 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
28294 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28295 }
else if (8 *
sizeof(
char) - 1 > 2 * PyLong_SHIFT) {
28296 return (
char) ((((((char)digits[1]) << PyLong_SHIFT) | (
char)digits[0])));
28301 if (8 *
sizeof(
char) - 1 > 2 * PyLong_SHIFT) {
28302 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
28303 __PYX_VERIFY_RETURN_INT(
char,
long, -(
long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28304 }
else if (8 *
sizeof(
char) - 1 > 3 * PyLong_SHIFT) {
28305 return (
char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (
char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
28310 if (8 *
sizeof(
char) > 2 * PyLong_SHIFT) {
28311 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
28312 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28313 }
else if (8 *
sizeof(
char) - 1 > 3 * PyLong_SHIFT) {
28314 return (
char) ((((((((char)digits[2]) << PyLong_SHIFT) | (
char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
28319 if (8 *
sizeof(
char) - 1 > 3 * PyLong_SHIFT) {
28320 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
28321 __PYX_VERIFY_RETURN_INT(
char,
long, -(
long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28322 }
else if (8 *
sizeof(
char) - 1 > 4 * PyLong_SHIFT) {
28323 return (
char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (
char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (
char)digits[0])));
28328 if (8 *
sizeof(
char) > 3 * PyLong_SHIFT) {
28329 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
28330 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
28331 }
else if (8 *
sizeof(
char) - 1 > 4 * PyLong_SHIFT) {
28332 return (
char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (
char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (
char)digits[0])));
28338 if (
sizeof(
char) <=
sizeof(long)) {
28339 __PYX_VERIFY_RETURN_INT_EXC(
char,
long, PyLong_AsLong(x))
28340 #ifdef HAVE_LONG_LONG
28341 }
else if (
sizeof(
char) <=
sizeof(PY_LONG_LONG)) {
28342 __PYX_VERIFY_RETURN_INT_EXC(
char, PY_LONG_LONG, PyLong_AsLongLong(x))
28347 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
28348 PyErr_SetString(PyExc_RuntimeError,
28349 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
28352 PyObject *
v = __Pyx_PyNumber_IntOrLong(x);
28353 #if PY_MAJOR_VERSION < 3
28354 if (likely(
v) && !PyLong_Check(
v)) {
28356 v = PyNumber_Long(tmp);
28361 int one = 1;
int is_little = (int)*(
unsigned char *)&one;
28362 unsigned char *bytes = (
unsigned char *)&val;
28363 int ret = _PyLong_AsByteArray((PyLongObject *)
v,
28364 bytes,
sizeof(val),
28365 is_little, !is_unsigned);
28375 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
28376 if (!tmp)
return (
char) -1;
28377 val = __Pyx_PyInt_As_char(tmp);
28382 PyErr_SetString(PyExc_OverflowError,
28383 "value too large to convert to char");
28385 raise_neg_overflow:
28386 PyErr_SetString(PyExc_OverflowError,
28387 "can't convert negative value to char");
28392 static int __Pyx_check_binary_version(
void) {
28393 char ctversion[4], rtversion[4];
28394 PyOS_snprintf(ctversion, 4,
"%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
28395 PyOS_snprintf(rtversion, 4,
"%s", Py_GetVersion());
28396 if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
28398 PyOS_snprintf(message,
sizeof(message),
28399 "compiletime version %s of module '%.100s' "
28400 "does not match runtime version %s",
28401 ctversion, __Pyx_MODULE_NAME, rtversion);
28402 return PyErr_WarnEx(NULL, message, 1);
28408 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
28410 #if PY_MAJOR_VERSION < 3
28411 if (t->is_unicode) {
28412 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
28413 }
else if (t->intern) {
28414 *t->p = PyString_InternFromString(t->s);
28416 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
28419 if (t->is_unicode | t->is_str) {
28421 *t->p = PyUnicode_InternFromString(t->s);
28422 }
else if (t->encoding) {
28423 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
28425 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
28428 *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
28433 if (PyObject_Hash(*t->p) == -1)
28440 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(
const char* c_str) {
28441 return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
28443 static CYTHON_INLINE
const char* __Pyx_PyObject_AsString(PyObject* o) {
28445 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
28447 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
28448 #if !CYTHON_PEP393_ENABLED
28449 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
28451 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
28452 if (!defenc)
return NULL;
28453 defenc_c = PyBytes_AS_STRING(defenc);
28454 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
28456 char* end = defenc_c + PyBytes_GET_SIZE(defenc);
28458 for (
c = defenc_c;
c < end;
c++) {
28459 if ((
unsigned char) (*
c) >= 128) {
28460 PyUnicode_AsASCIIString(o);
28466 *length = PyBytes_GET_SIZE(defenc);
28470 static CYTHON_INLINE
const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
28471 if (unlikely(__Pyx_PyUnicode_READY(o) == -1))
return NULL;
28472 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
28473 if (likely(PyUnicode_IS_ASCII(o))) {
28474 *length = PyUnicode_GET_LENGTH(o);
28475 return PyUnicode_AsUTF8(o);
28477 PyUnicode_AsASCIIString(o);
28481 return PyUnicode_AsUTF8AndSize(o, length);
28486 static CYTHON_INLINE
const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
28487 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
28489 #
if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
28490 __Pyx_sys_getdefaultencoding_not_ascii &&
28492 PyUnicode_Check(o)) {
28493 return __Pyx_PyUnicode_AsStringAndSize(o, length);
28496 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
28497 if (PyByteArray_Check(o)) {
28498 *length = PyByteArray_GET_SIZE(o);
28499 return PyByteArray_AS_STRING(o);
28504 int r = PyBytes_AsStringAndSize(o, &result, length);
28505 if (unlikely(
r < 0)) {
28512 static CYTHON_INLINE
int __Pyx_PyObject_IsTrue(PyObject* x) {
28513 int is_true = x == Py_True;
28514 if (is_true | (x == Py_False) | (x == Py_None))
return is_true;
28515 else return PyObject_IsTrue(x);
28517 static CYTHON_INLINE
int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
28519 if (unlikely(!x))
return -1;
28520 retval = __Pyx_PyObject_IsTrue(x);
28524 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result,
const char* type_name) {
28525 #if PY_MAJOR_VERSION >= 3
28526 if (PyLong_Check(result)) {
28527 if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
28528 "__int__ returned non-int (type %.200s). "
28529 "The ability to return an instance of a strict subclass of int "
28530 "is deprecated, and may be removed in a future version of Python.",
28531 Py_TYPE(result)->tp_name)) {
28538 PyErr_Format(PyExc_TypeError,
28539 "__%.4s__ returned non-%.4s (type %.200s)",
28540 type_name, type_name, Py_TYPE(result)->tp_name);
28544 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
28545 #if CYTHON_USE_TYPE_SLOTS
28546 PyNumberMethods *m;
28548 const char *name = NULL;
28549 PyObject *res = NULL;
28550 #if PY_MAJOR_VERSION < 3
28551 if (likely(PyInt_Check(x) || PyLong_Check(x)))
28553 if (likely(PyLong_Check(x)))
28555 return __Pyx_NewRef(x);
28556 #if CYTHON_USE_TYPE_SLOTS
28557 m = Py_TYPE(x)->tp_as_number;
28558 #if PY_MAJOR_VERSION < 3
28559 if (m && m->nb_int) {
28561 res = m->nb_int(x);
28563 else if (m && m->nb_long) {
28565 res = m->nb_long(x);
28568 if (likely(m && m->nb_int)) {
28570 res = m->nb_int(x);
28574 if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
28575 res = PyNumber_Int(x);
28579 #if PY_MAJOR_VERSION < 3
28580 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
28582 if (unlikely(!PyLong_CheckExact(res))) {
28584 return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
28587 else if (!PyErr_Occurred()) {
28588 PyErr_SetString(PyExc_TypeError,
28589 "an integer is required");
28593 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
28596 #if PY_MAJOR_VERSION < 3
28597 if (likely(PyInt_CheckExact(b))) {
28598 if (
sizeof(Py_ssize_t) >=
sizeof(
long))
28599 return PyInt_AS_LONG(b);
28601 return PyInt_AsSsize_t(b);
28604 if (likely(PyLong_CheckExact(b))) {
28605 #if CYTHON_USE_PYLONG_INTERNALS
28606 const digit* digits = ((PyLongObject*)b)->ob_digit;
28607 const Py_ssize_t size = Py_SIZE(b);
28608 if (likely(__Pyx_sst_abs(size) <= 1)) {
28609 ival = likely(size) ? digits[0] : 0;
28610 if (size == -1) ival = -ival;
28615 if (8 *
sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
28616 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0]));
28620 if (8 *
sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
28621 return -(Py_ssize_t) (((((
size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
28625 if (8 *
sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
28626 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (
size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
28630 if (8 *
sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
28631 return -(Py_ssize_t) (((((((
size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0]));
28635 if (8 *
sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
28636 return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (
size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0]));
28640 if (8 *
sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
28641 return -(Py_ssize_t) (((((((((
size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (
size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
28647 return PyLong_AsSsize_t(b);
28649 x = PyNumber_Index(b);
28651 ival = PyInt_AsSsize_t(x);
28655 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(
long b) {
28656 return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
28658 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(
size_t ival) {
28659 return PyInt_FromSize_t(ival);